设置:Kotlin在春季启动应用程序中的集成测试。
当我使用IntelliJ运行测试时,它们运行良好。 但是,当我尝试使用Maven运行集成测试时:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test (default) on project myapp: Execution default of goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test failed: There was an error in the forked process
[ERROR] java.lang.NoClassDefFoundError: ch/cypherk/myapp/service/CustomerService
[ERROR] at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
[ERROR] at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3138)
[ERROR] at java.base/java.lang.Class.getConstructor0(Class.java:3343)
[ERROR] at java.base/java.lang.Class.getConstructor(Class.java:2152)
[ERROR] at org.apache.maven.surefire.junit.PojoAndJUnit3Checker.isPojoTest(PojoAndJUnit3Checker.java:51)
...
这很烦人,因为我有点需要竹子来处理令人毛骨悚然的东西。
CustomerService
是一个接口,是的,它已经被编译,在maven的.class
目录中有一个相应的./target
文件,并且IntelliJ已设置为使用该接口。
无法完全弄清为什么会失败,因此希望插件提供一些帮助。
pom.xml
的相关摘录:
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<!-- doesn't make a difference if `true` or `false`-->
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/*IT*</include>
</includes>
<excludes>
<exclude>**/ui/*</exclude>
</excludes>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
全pom.xml
:http://freetexthost.com/dbghyawijj
集成测试失败步骤的完整日志:http://freetexthost.com/gbsmd3mwm2