Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executable jar built with spring-boot gradle-plugin missing dependency

I have an executable JAR that I've built with Spring Boot's Gradle plugin. It has the following dependencies in the build file:

build.gradle

compile('org.apache.activemq:activemq-client:5.9.0')
compile('org.apache.activemq:activemq-broker:5.9.0')
compile('org.apache.activemq:activemq-kahadb-store:5.9.0')
compile('org.apache.activemq.protobuf:activemq-protobuf:1.1')

The problem is that after I run ./gradlew clean build the created artifact does not contain the activemq-protobuf jar, only the other activemq jars:

[] jar -tf build/libs/application-0.1.0.jar | grep activemq
lib/activemq-client-5.9.0.jar
lib/activemq-broker-5.9.0.jar
lib/activemq-kahadb-store-5.9.0.jar
lib/activemq-openwire-legacy-5.9.0.jar

So when I try to run the jar, I got an Exception that a class from this dependency cannot be found:

java.lang.ClassNotFoundException: org.apache.activemq.protobuf.Message

During the build the dependency gets downloaded and it can be found in my gradle cache, it seems that for some reason Spring Boot's Gradle plugin doesn't include it during the bootRepackage task.

This dependency is also there in Eclipse, and the project can be run from there.

Any ideas about why it gets missing?

like image 618
Márton Sereg Avatar asked Nov 10 '22 11:11

Márton Sereg


1 Answers

This looks like a bug in Spring Boot. I've opened an issue so that we can investigate. Thanks for bringing it to our attention.

like image 69
Andy Wilkinson Avatar answered Nov 14 '22 22:11

Andy Wilkinson