I've got a Spring Boot Maven project that creates an executable fat .war
. I can run this .war
using java -jar
without any issues as all dependencies are located within the far .war
.
However, I can't run the project with the Spring Boot Devtools using mvn spring-boot:run
as it fails to find some dependencies at runtime and throws unhandled exceptions.
For example, we've got an indirect dependency on jaxb-runtime-2.3.1.jar
which in turn has a dependency on jaxb-api.2.3.1.jar
. Both .jars
are present in the fat .war
but if I run the project with mvn spring-boot:run
it can find jaxb-runtime
ok but fails to find jaxb-api
with the message:
java.nio.file.NoSuchFileException: ~/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/jaxb-api-2.3.1.jar
Note, jaxb-api-2.3.1.jar
is present in the maven cache at:
~/.m2/repository/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
however it seems to be looking for it in the same location as the parent jaxb-runtime-2.3.1.jar
which is located at:
~/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.3.1/
There's a long list of similar exceptions that follow this pattern. It's quite a large project but here are some of the versions we're using:
Spring Boot: 2.1.9.RELEASE
spring-boot-maven-plugin: 2.1.9.RELEASE
maven-compiler-plugin: 3.8.1
spring-boot-devtools: not specified in pom
Why does spring-boot:run
not locate dependencies in the same way as the maven build? How can I instruct it where to find these dependencies?