I have a spring-boot application which is structured as gradle multi-project.
Gradle version : 3.3
Spring boot version : 1.5.4
The hierarchy looks like :
rootProject.name = 'omsProject'
include 'oms'
include 'customer-svc-client'
As per the directory structure :
src/main/java
oms/src/main/java
oms/src/test/java
customer-svc-client/src/main/java
customer-svc-client/src/test/java
The subproject oms
depends on customer-svc-client
.
gradle test
and gradle :oms:test
both run just fine.
However, when I do gradle build
, the :oms:test
task fails with NoClassDefFoundError
:
:oms:test
com.example.oms.service.OrderResourceTests > testGetAllOrdersCount FAILED
java.lang.NoClassDefFoundError at OrderResourceTests.java:25
Caused by: java.lang.ClassNotFoundException at OrderResourceTests.java:25
Stcktrace from the html test report shows :
java.lang.NoClassDefFoundError: com/example/grasclient/CustomerServiceClient
....
....
Caused by: java.lang.ClassNotFoundException: com.example.grasclient.CustomerServiceClient
I tried adding testCompile
, and adding test classpath but that didnt help.
Can anyone help me in this ?