View the Gradle task in the Spring Boot project

View Gradle tasks

You can see the list of tasks with the command below.

.\gradlew.bat task --all

It is displayed as below.

> Task :tasks

------------------------------------------------------------
Tasks runnable from root project
------------------------------------------------------------

Application tasks
-----------------
bootRun - Runs this project as a Spring Boot application.

Build tasks
-----------
assemble - Assembles the outputs of this project.
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.

Build Setup tasks
-----------------
init - Initializes a new Gradle build.
wrapper - Generates Gradle wrapper files.

Documentation tasks
-------------------
javadoc - Generates Javadoc API documentation for the main source code.

Help tasks
----------
buildEnvironment - Displays all buildscript dependencies declared in root project 'demo'.
components - Displays the components produced by root project 'demo'. [incubating]
dependencies - Displays all dependencies declared in root project 'demo'.
dependencyInsight - Displays the insight into a specific dependency in root project 'demo'.
dependencyManagement - Displays the dependency management declared in root project 'demo'.
dependentComponents - Displays the dependent components of components in root project 'demo'. [incubating]
help - Displays a help message.
model - Displays the configuration model of root project 'demo'. [incubating]
outgoingVariants - Displays the outgoing variants of root project 'demo'.
projects - Displays the sub-projects of root project 'demo'.
properties - Displays the properties of root project 'demo'.
tasks - Displays the tasks runnable from root project 'demo'.

Verification tasks
------------------
check - Runs all checks.
test - Runs the unit tests.

Other tasks
-----------
compileJava - Compiles main Java source.
compileTestJava - Compiles test Java source.
prepareKotlinBuildScriptModel
processResources - Processes main resources.
processTestResources - Processes test resources.

Rules
-----
Pattern: clean<TaskName>: Cleans the output files of a task.
Pattern: build<ConfigurationName>: Assembles the artifacts of a configuration.
Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.

Build-related tasks

There are nine build tasks alone. There are tasks derived from the java plugin and tasks derived from the ʻorg.springframework.boot` plugin.

Build tasks
-----------
assemble - Assembles the outputs of this project.
bootJar - Assembles an executable jar archive containing the main classes and their dependencies.
build - Assembles and tests this project.
buildDependents - Assembles and tests this project and all projects that depend on it.
buildNeeded - Assembles and tests this project and all projects it depends on.
classes - Assembles main classes.
clean - Deletes the build directory.
jar - Assembles a jar archive containing the main classes.
testClasses - Assembles test classes.

The task dependencies are easy to understand by looking at the image below.

javaPluginTasks.png

(Reprinted from https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_tasks)

assemble task

After generating the jar file, it also generates the product set in ʻarchives. You can also create a custom zip file at build time by creating a zip-generating task and adding it to ʻarchives.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJar
> Task :jar SKIPPED
> Task :assemble

bootJar task

The task of generating an executable jar file that contains the main class and all its dependencies. If you don't want to run the test and just want the jar file, do this task.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJar

build task

Perform this task when building normally. For multi-project, build only the current project. The test is also run and a test report is generated under the build \ reports directory.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJar
> Task :jar SKIPPED
> Task :assemble
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses

> Task :test
2020-04-30 13:26:22.615  INFO 5520 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

> Task :processTestResources NO-SOURCE
> Task :testClasses

buildDependents task

One of the build methods for multi-project. If you build with buildDependents, all projects that have a dependency of the testRuntimeClasspath setting in the current project will also be built.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJar
> Task :jar SKIPPED
> Task :assemble
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses

> Task :test
2020-04-30 13:27:15.725  INFO 16828 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

> Task :check
> Task :build
> Task :buildDependents

buildNeeded task

One of the build methods for multi-project. Not only the current project, but all projects that the project depends on with the testRuntimeClasspath setting will be built.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :bootJar
> Task :jar SKIPPED
> Task :assemble
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses

> Task :test
2020-04-30 13:27:40.483  INFO 9032 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'

> Task :check
> Task :build
> Task :buildNeeded

classes task

The task of compiling Java main source code and creating class files. IntelliJ has a decompiler that can parse the contents of class files on the IDE, but the substance is compiled bytecode.

Output

> Task :compileJava
> Task :processResources
> Task :classes

clean task

The task of deleting the build directory.

Output

> Task :clean

jar task

Compile the main source set and generate a jar file. In this project, the jar task is skipped probably because there is a bootJar task.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :jar SKIPPED

testClasses task

The task of compiling Java test source code and creating test class files.

Output

> Task :compileJava
> Task :processResources
> Task :classes
> Task :compileTestJava
> Task :processTestResources NO-SOURCE
> Task :testClasses

Recommended Posts

View the Gradle task in the Spring Boot project
Java tips-Create a Spring Boot project in Gradle
Spring Boot 2 multi-project in Gradle
Build Spring Boot + Docker image in Gradle
Create Java Spring Boot project in IntelliJ
Run a Spring Boot project in VS Code
Build Spring Boot project by environment with Gradle
Specify the encoding of static resources in Spring Boot
How to create a Spring Boot project in IntelliJ
Try gRPC in Spring Boot & Spring Cloud project (Mac OS)
Deploy the Spring Boot project to Tomcat on XAMPP
Set context-param in Spring Boot
Spring Boot tutorial task schedule
Major changes in Spring Boot 1.5
Spring Boot 1.x will reach EOL in the next year.
Spring Boot application development in Eclipse
Automatically specify version in gradle project
◆ Spring Boot + gradle environment construction memo
Spring Boot for the first time
Write test code in Spring Boot
Spring Boot: Restful API sample project
Implement REST API in Spring Boot
What is @Autowired in Spring boot?
Thymeleaf usage notes in Spring Boot
Spring Boot gradle build with Docker
Set Spring profile when executing bootRun task with Spring Boot Gradle Plugin
Get a proxy instance of the component itself in Spring Boot
See the relative redirect behavior with the server.tomcat.use-relative-redirects setting in Spring Boot
What I did in the migration from Spring Boot 1.4 series to 2.0 series
What I did in the migration from Spring Boot 1.5 series to 2.0 series
Create a Spring Boot project in intellij and exit immediately after launching
Create a Spring Boot app development project with the cURL + tar command
A story about a Spring Boot project written in Java that supports Kotlin
Static file access priority in Spring boot
Procedure to make the value of the property file visible in Spring Boot
Output Spring Boot log in json format
Local file download memorandum in Spring Boot
Loosen Thymeleaf syntax checking in Spring Boot
Separate Task Executors used in Spring @Async
[Practice! ] Display Hello World in Spring Boot
Use DynamoDB query method in Spring Boot
Spring Boot, Doma2, Gradle initial setting summary
Define a task to ZIP archive a set of project files in Gradle
[For internal use] For those assigned to the Spring Boot project (under construction)
DI SessionScope Bean in Spring Boot 2 Filter
(IntelliJ + gradle) Hello World with Spring Boot
Add spring boot and gradle to eclipse
Change session timeout time in Spring Boot
Organize the differences in behavior of @NotBlank, @NotEmpty, @NotNull with Spring Boot + Thymeleaf
Sign in to a Spring Boot web application on the Microsoft ID platform
Get the path defined in Controller class of Spring boot as a list
How to set environment variables in the properties file of Spring boot application
The attached file name was garbled in the Spring Boot email, so take measures
Create a website with Spring Boot + Gradle (jdk1.8.x)
SameSite cookie in Spring Boot (Spring Web MVC + Tomcat)
Use static analysis tools in your Gradle project
Run modular project tests in Gradle (JUnit5 + TestFX)
Output request and response log in Spring Boot
The story of raising Spring Boot 1.5 series to 2.1 series
Let's check the feel of Spring Boot + Swagger 2.0
Use Servlet filter in Spring Boot [Spring Boot 1.x, 2.x compatible]