gpt4 book ai didi

java - maven编译的问题

转载 作者:行者123 更新时间:2023-12-01 17:36:46 25 4
gpt4 key购买 nike

当尝试使用 selenium wd 和 testng 在 jenkins 中构建 E2E 项目时,出现以下错误:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[9,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[10,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[11,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[12,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[13,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[14,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[15,22] package org.testng.xml does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[21,42] cannot find symbol
symbol: class IReporter
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,37] cannot find symbol
symbol: class XmlSuite
location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,63] cannot find symbol
symbol: class ISuite
location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[43,33] cannot find symbol
symbol: class IResultMap
location: class resources.ExtentReporterNG
[INFO] 11 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.605 s
[INFO] Finished at: 2020-04-03T19:51:37-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project E2EProject: Compilation failure: Compilation failure:
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[9,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[10,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[11,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[12,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[13,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[14,18] package org.testng does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[15,22] package org.testng.xml does not exist
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[21,42] cannot find symbol
[ERROR] symbol: class IReporter
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,37] cannot find symbol
[ERROR] symbol: class XmlSuite
[ERROR] location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[24,63] cannot find symbol
[ERROR] symbol: class ISuite
[ERROR] location: class resources.ExtentReporterNG
[ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[43,33] cannot find symbol
[ERROR] symbol: class IResultMap
[ERROR] location: class resources.ExtentReporterNG
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

之前运行 mvncompile 命令时不会发生这种情况,但是在更新我的 POM 并重新编译后,它也开始在终端中显示。当从 eclipse 中的 testng.xml 运行该项目时,该项目运行得非常好。

这是我的 POM 文件的样子

 <url>http://maven.apache.org</url>



<build>
<resources>
<resource>
<directory>src/main/java/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>


</build>
<dependencies>

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

<dependency>
<groupId>com.apple</groupId>
<artifactId>AppleJavaExtensions</artifactId>
<version>1.4</version>
</dependency>

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.1.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.6</version>
</dependency>

<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.8.2</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.8.2</version>
</dependency>

</dependencies>
</project>

附上项目外观的图片:

Project

最佳答案

我终于能够通过更新我的 POM 文件来解决这个问题,执行以下操作:删除具有 avenstack groupID 的范围报告依赖项

<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.0.6</version>
</dependency>

将其他范围报告更新为此 v:

<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>3.1.5</version>
</dependency>

并添加这个:

<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.28</version>
</dependency>

关于java - maven编译的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61022215/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com