【发布时间】:2015-03-26 00:00:37
【问题描述】:
我们遇到了这样一个奇怪的错误。我们的测试在本地机器(windows)上运行,但不在jenkins(linux)上运行。
我们得到一个
Caused by: java.lang.RuntimeException: There was an error in the forked process
java.lang.NoClassDefFoundError:
我正在寻找解决方案并在 bugzilla 上获得此信息 或archive。
有人知道这个问题以及如何解决它吗?
谢谢
更新
maven-surefire-plugin 也在父 pom.xml 中定义,用于与 cobertura 一起使用。测试运行两次,但第二次测试失败,如上所述。
我正在定义 2 个使用 surefire 插件的配置文件和该部分中的一个 surefire 插件定义。
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
<exclude>**/*SoapUiTest.java</exclude>
</excludes>
<excludes>
<!--exclude>**/*.java</exclude -->
</excludes>
<additionalClasspathElements>
<additionalClasspathElement>${basedir}/src/main/java</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>soapUi</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*SoapUiTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<excludes>
<exclude>**/*EntityTest.java</exclude>
</excludes>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
我做错了什么?
【问题讨论】:
-
尝试在 linux 命令行中使用
mvn -e test执行测试,看看会发生什么。
标签: linux jenkins maven-surefire-plugin