0

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?

eoinmullan
  • 1,157
  • 1
  • 9
  • 32
  • It's difficult to point out the issue from the info provided. However, did you try deleting contents of the m2 repository and running `mvn clean install` in the root folder of the project after formatting m2 dir? – noob_nerd Nov 20 '21 at 18:59
  • @noob_nerd, yes, I've tried that and it still doesn't work. We're also seeing this issue on a number of different machines. – eoinmullan Nov 22 '21 at 09:20

0 Answers0