Difference between gradle build and gradle bootJar?

Viewed 11868

What is the difference between "gradle build" and "gradle bootJar"? Why would I use bootJar if I can still create the artifact using build?

1 Answers

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.

Related