When I build a spring-boot application (to a standalone jar) using gradle build
, the proper artifacts are generated. The resulting jar contains all dependent jars and is executable.
I have also configured the maven-publish plugin as follows:
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
Now when I execute gradle publish
, a much smaller jar without dependencies gets build and published.
Following steps are not executed in the latter case.
:myProject:bootRepackage
:myProject:assemble
How can I make sure the correct build steps are executed when publishing?
I'm a little surprised that publishing from components.java
doesn't trigger the Java plugin's assemble
task. Spring Boot's bootRepackage
task is setup as a dependency of the assemble
task so you'll need to cause publish
to run assemble
. Try adding the following to your build.gradle
:
publish {
dependsOn assemble
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With