通过cron job" org.apache.maven.surefire.booter.SurefireExecutionException运行pom.xml时出现此错误:提供程序中的异常"

时间:2017-06-09 11:39:55

标签: java maven

我在centos机器上运行我的基于selenium maven的项目。我正在使用此命令" mvn clean test"运行脚本。

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-   plugin:2.20:test (default-test) on project BaTAutomation: There are test failures.    
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump,    
[ERROR] Exception in provider
[ERROR] org.apache.maven.surefire.booter.SurefireExecutionException: Exception in provider
[ERROR] at org.apache.maven.plugin.surefire.InPluginVMSurefireStarter.runSuitesInProcess(InPluginVMSurefireStarter.java:88)
[ERROR] at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1060)

有人可以告诉我为什么会收到此错误。

我的POM.xml文件是

     <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>com.indusface.testtas</groupId>
  <artifactId>BaTAutomation</artifactId>
  <version>0.0.1-SNAPSHOT</version>
   <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
  <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>6.11</version>
  </dependency> 
  <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
  </dependency>
  <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk</artifactId>
    <version>1.11.98</version>
</dependency>
  <dependency>
    <groupId>commons-configuration</groupId>
    <artifactId>commons-configuration</artifactId>
    <version>1.10</version>
  </dependency>
  <dependency>
    <groupId>com.relevantcodes</groupId>
    <artifactId>extentreports</artifactId>
    <version>2.41.2</version>
   </dependency>
    <dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1</version>
</dependency>
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4</version>
</dependency>
  </dependencies>
  <build>
        <plugins>
            <!-- Following plugin executes the testng tests -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.20</version>
                <configuration>
                     <forkMode>never</forkMode>
                    <!-- Suite testng xml file to consider for test execution -->
                    <suiteXmlFiles>
                             <suiteXmlFile>TestNG.xml</suiteXmlFile>
                     </suiteXmlFiles>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
   </project>

请告诉我我的pom.xml文件中有什么问题

1 个答案:

答案 0 :(得分:0)

我的问题得到了解决。我重新启动了我的centos机器,这就是为什么我的centos机器DISPLAY发生了变化。所以我遇到了上述问题。更改为更新的DISPLAY后,它工作正常