Reputation: 2395
When I try to rename the jar file generated on build Spring does not generate a fat jar anymore:
jar {
manifest {
attributes 'Main-Class': mainClassName
}
baseName = 'app'
classifier = null
version = null
}
I will see the app.jar
in my /build/libs/
folder but it only contains the project not the dependencies and no other files are generated. How can I make Spring rename the jar it generates which includes the dependencies?
Upvotes: 0
Views: 279
Reputation: 116281
You have set the classifier on the jar
task to null
rather than the default of an empty string (""
). Unless you explicitly configure bootRepackage
to apply to a jar
task, tasks with a non-default classifier are ignored. This is hinted at in the info-level logging of bootRepackage
:
Jar task not repackaged (didn't match withJarTask): task ':jar'
The simplest thing to do is to leave the classifier
with its default empty string value. This would leave your jar
task with the following configuration:
jar {
baseName = 'app'
version = null
}
When bootRepackage
runs, the app.jar
file produced by the jar
task will then be repackaged and contain its dependencies as you require.
Upvotes: 1