When running the below code with Spring Boot v1.3.7 all works fine, but after bumping to version 1.4.0 maven goes crazy.
I was trying to do a simple integration test, not sure if I am doing something very wrong.
Basically running mvn clean package works on v 1.3.7 and stops working on v 1.4.0
The readme has details on how to reproduce and what breaks.
Simple project to reproduce https://github.com/pedroxs/multi-module-exception
This is due to the change in layout of executable jars in Spring Boot 1.4. Application classes are now packaging in BOOT-INF/classes.
Your client module depends on the repackaged, fat jar of your web module. Due to the new layout that means that the client module can no longer load the web module's classes. If you want to use your web module as a dependency, you should configure Boot's repackaging to apply a classifier to the fat jar. For example:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Doing so will allow other modules to depend on the original jar that does not embed the module's dependencies and has the classes at the root of the jar.
There is also an example in the doc - I've just polished that in cf07d19
Thanks this solves the issue. Would you recommend a different approach for such kind of integration tests?
Thanks! It works for me.
Thanks, it's very useful for me.
Most helpful comment
This is due to the change in layout of executable jars in Spring Boot 1.4. Application classes are now packaging in
BOOT-INF/classes.Your client module depends on the repackaged, fat jar of your web module. Due to the new layout that means that the client module can no longer load the web module's classes. If you want to use your web module as a dependency, you should configure Boot's repackaging to apply a classifier to the fat jar. For example:
Doing so will allow other modules to depend on the original jar that does not embed the module's dependencies and has the classes at the root of the jar.