簡體   English   中英

無法在項目上執行目標 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile)

[英]Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on projec

我正在測試自動化工程師,我已經為自動化腳本配置了 Jenkins 和 maven 項目,幾天前我的所有腳本在 Jenkins 和本地運行良好,但是現在當我通過異常在 Jenkins 和本地系統中運行構建時,當我在本地運行時嘗試更新我的 maven 項目並通過命令“maven test”運行腳本它工作正常並且所有腳本在我嘗試運行命令“maven clean”然后運行命令作為“maven test”運行然后系統生成我一個錯誤時我嘗試從 jenkins 運行相同的 porm.xml 文件,而沒有命令“clean test”它工作正常,但命令總是面臨相同類型的異常。 “錯誤] 無法在項目 EventBuizz 上執行目標 org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile): Compilation failure [ERROR] /E:/Automation/eclipse-workspace/ EventBuizz/src/test/java/EventBuizz/EventBuizz/EventCenterDashBoard.java:[21,34] 包 org.apache.tools.ant.types 不存在 [ERROR] -> [Help 1] [ERROR] [ERROR] To查看錯誤的完整堆棧跟蹤,使用 -e 開關重新運行 Maven。[ERROR] 使用 -X 開關重新運行 Maven 以啟用完整的調試日志記錄。[ERROR] [ERROR] 有關錯誤和可能的解決方案,請閱讀以下文章:"

我已經為此瀏覽了其他帖子,並按照建議對我的 .pom 文件進行了一些更改,但我仍然遇到相同的錯誤。 不確定要提供哪些其他有用的信息,因此請告訴我哪些其他信息對解決此問題有用。 下面是我的 .pom 文件

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
    >
    <modelVersion>4.0.0</modelVersion>
    <groupId>EventBuizz</groupId>
    <artifactId>EventBuizz</artifactId>
    <version>0.0.1-SNAPSHOT</version>


    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
         </properties>
    <dependencies>



        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>maven-dependency-tree</artifactId>
            <version>3.0.1</version>
        </dependency>
        <!-- Selenium -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>

        <!-- TestNG -->
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>6.14.3</version>
            <scope>test</scope>
        </dependency>

        <!--JUnit -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>

        <!--Maven Plugin -->
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <type>maven-plugin</type>



        </dependency>

        <!--Extent Report -->
        <dependency>
            <groupId>com.relevantcodes</groupId>
            <artifactId>extentreports</artifactId>
            <version>2.41.2</version>
        </dependency>

<dependency>
  <!-- jsoup HTML parser library @ https://jsoup.org/-->
  <groupId>org.jsoup</groupId>
  <artifactId>jsoup</artifactId>
  <version>1.12.1</version>
</dependency>

    </dependencies>



    <build>
        <plugins>

            <!--Maven Plugin -->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                </configuration>
            </plugin>

            <!--Maven surfire plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <printSummary>true</printSummary>
                    <suiteXmlFiles>
                        <suiteXmlFile>testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>
        </plugins>
    </build>





</project>

我想使用命令“clean test”在 jenkins 中運行我的測試腳本。

testCompile階段編譯應用程序測試源。 如果此階段失敗,則test階段將失敗。 檢查您遇到的錯誤 - Compilation failure [ERROR] /E:/Automation/eclipse-workspace/EventBuizz/src/test/java/EventBuizz/EventBuizz/EventCenterDashBoard.java:[21,34] package org.apache.tools.ant.types does not exist我會通過檢查這個類來開始調試它。 您的項目中似乎缺少庫 - org.apache.tools.ant.types

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM