Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java maven编译问题_Java_Maven_Jenkins_Testng_Pom.xml - Fatal编程技术网

Java maven编译问题

Java maven编译问题,java,maven,jenkins,testng,pom.xml,Java,Maven,Jenkins,Testng,Pom.xml,尝试在jenkins中使用selenium wd和testng构建E2E项目时,我遇到了以下错误: [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /Users/VickoS/.jenkins/E2EProject/src/main/java/resources/ExtentReporterNG.java:[9,18] package

尝试在jenkins中使用selenium wd和testng构建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
这在之前运行mvncomile命令时并没有发生,但在更新我的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>
http://maven.apache.org
src/main/java/resources
真的
org.apache.maven.plugins

我终于能够通过更新POM文件来解决这个问题,方法是执行以下操作: 正在删除具有AventStack groupID的扩展数据块报告依赖项

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

com.aventstack
扩展端口
3.0.6
将其他扩展数据块报告更新到此版本:

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

com.aventstack
扩展端口
3.1.5
加上这个:

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

org.freemarker
自由标记
2.3.28

我终于能够通过更新POM文件来解决这个问题,方法如下: 正在删除具有AventStack groupID的扩展数据块报告依赖项

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

com.aventstack
扩展端口
3.0.6
将其他扩展数据块报告更新到此版本:

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

com.aventstack
扩展端口
3.1.5
加上这个:

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

org.freemarker
自由标记
2.3.28

从pom文件中的testng依赖项中删除测试。保存pom文件,然后编译,它应该可以工作。删除配置
src/main/java/resources
,因为它违反了配置范例的约定。此外,默认情况下,您应该在
src/main/resources
中找到资源,然后首先清除编译错误。如果您想使用testng做一些事情,那么可以看到依赖关系的类需要进入src/test/java-所以将ExtentReporterNG.java移动到该文件夹结构中-路径/src/main/java/resources/lookes很奇怪。“资源”是您的包名吗?或者是意外移动了什么东西?从范围中删除“测试”是不起作用的。是的,资源就是一揽子计划name@Vicko如果
resources
是包名(这可能是个坏主意),但您不应该在包中添加资源筛选,因为只有
*。java
应该位于…资源(属性文件等)应位于
src/main/resources
…从pom文件中的testng依赖项中删除测试。保存pom文件,然后编译,它应该可以工作。删除配置
src/main/java/resources
,因为它违反了配置范例的约定。此外,默认情况下,您应该在
src/main/resources
中找到资源,然后首先清除编译错误。如果您想使用testng做一些事情,那么可以看到依赖关系的类需要进入src/test/java-所以将ExtentReporterNG.java移动到该文件夹结构中-路径/src/main/java/resources/lookes很奇怪。“资源”是您的包名吗?或者是意外移动了什么东西?从范围中删除“测试”是不起作用的。是的,资源就是一揽子计划name@Vicko如果
resources
是包名(可能是个坏主意),但您不应该仅在包中添加该原因的资源筛选
*。应定位java
…资源(属性文件等)应位于
src/main/resources
。。。