无法在詹金斯执行Maven测试

时间:2019-03-16 14:17:18

标签: maven jenkins

im试图在jenkins执行mvn clean test命令中测试我的Java项目,但我收到此错误消息:

有关各个测试结果,请参考/ var / jenkins_home / workspace / test1 / target / surefire-reports。     请参考转储文件(如果存在)[date] .dump,[date] -jvmRun [N] .dump和[date] .dumpstream。     分叉的VM没有正确说再见就终止了。 VM崩溃还是System.exit被调用?     命令是/ bin / sh -c cd / var / jenkins_home / workspace / test1 && / usr / lib / jvm / java-8-openjdk-amd64 / jre / bin / java -jar / var / jenkins_home / workspace / test1 / target /surefire/surefirebooter4409725364462449811.jar / var / jenkins_home / workspace / test1 / target / surefire 2019-03-16T14-14-52_472-jvmRun1 surefire1202620073961749502tmp surefire_05802645415730668788tmp     启动分叉时发生错误,请检查日志中的输出     进程退出代码:1

我的POM文件:

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.1.3.RELEASE</version>
        <relativePath/>
  </parent>

    <groupId>com.selenuim</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

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

         <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>27.0.1-jre</version>
         </dependency>

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

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.openqa.selenium.core</groupId>
            <artifactId>selenium-core</artifactId>
            <version>1.0-20080914.225453</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

在我的本地计算机上工作正常,但是在jenkins服务器上! 我正在使用JDK 1.8,请问有什么想法吗?

1 个答案:

答案 0 :(得分:0)

在pom文件中设置maven-surefire-plugin版本可解决此问题:

<plugin>
   <artifactId>maven-surefire-plugin</artifactId>
   <version>3.0.0-M1</version>
</plugin>