Setup: Kotlin integration tests in a spring boot application.
Tests work fine when I run them with IntelliJ. When I try to run the integration tests with maven, though:
[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)
...
which is very annoying since I kind of need bamboo to run the darn things.
The CustomerService
is an interface and yes, it is compiled, there's a corresponding .class
file in maven's ./target
directory and IntelliJ is set up to use the same.
Can't quite figure out why this is failing and would appreciate some help with the plugin.
Relavant excerpt from the 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>
Full pom.xml
: http://freetexthost.com/dbghyawijj
Full log of the failing integration test step: http://freetexthost.com/gbsmd3mwm2
<useSystemClassLoader>
attribute was added to the Surefire config, but it's Failsafe that's having the problem. – Theran