Reputation: 1402
What is the difference between "gradle build" and "gradle bootJar"? Why would I use bootJar if I can still create the artifact using build?
Upvotes: 30
Views: 34256
Reputation: 6770
build
is a lifecycle task contributed by the Base Plugin. It is
Intended to build everything, including running all tests, producing the production artifacts and generating documentation. You will probably rarely attach concrete tasks directly to
build
asassemble
andcheck
are typically more appropriate.
bootJar
on the other hand is a specific task added by Spring Boot Gradle plugin that, when the java
plugin is present, attaches itself to the assemble
lifecycle task.
The
assemble
task is automatically configured to depend upon thebootJar
task so runningassemble
(orbuild
) will also run thebootJar
task.
You want to use bootJar
if you're only interested in building the executable jar and not interested in executing tests, code coverage, static code analysis or whatever is attached to the check
lifecycle task.
Upvotes: 34