Jiji
Jiji

Reputation: 1402

Difference between gradle build and gradle bootJar?

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

Answers (1)

Thomas K.
Thomas K.

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 as assemble and check 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 the bootJar task so running assemble (or build) will also run the bootJar task.

(Packaging Executable Jars)

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

Related Questions