[Gradle] About Java plug-in tasks

Java Plugin Task Dependencies

Most of the tasks included in Java plug-ins cannot be executed by themselves and have dependencies. Therefore, there is a task that should be executed first.

Task execution order and processing overview

compileJava / processResources task

Targets the main source set. Compile the Java source and copy the resources to the build file.

classes task

Run the compileJava and processResources tasks.

javadoc task

Generate a Javadoc based on the product that is the result of executing the classes task.

compileTestJava / processTestResources task

test Targets the source set. Compile the Java source and copy the resources to the build file.

testClasses task

Run the compileTestJava task and the processTestResources task.

test task

Run the testClasses, compileTestJava, processTestResources tasks, Generate a report of test execution results in XML format.

check task

Determine whether the build is possible based on the XML file generated by the test task.

jar task

classes Files, resources, libraries, etc. that are the products of tasks To a JAR file.

puloadArchives task

Upload archives such as JAR files to repositories.

assemble task

In the default setting, the execution content is the same as the jar task.

build task

Run the check and assemble tasks.

Task overview

compileJava task / compileTestJava task

JavaCompile type task. Compile Java source with the javac command. Under the directory specified by the java.srcDirs property Compile a file with a .java extension.

processResources task / processTestResources task

Copy type task. Copy the resource to the class output destination. Files under the directory specified by the resources.srcDirs property with a non-.java extension Copy to the output destination of the source set (setting value of output property).

jar task

Jar type task. Generate a JAR file. output property of main source set (= output of compileJava task and processResources task) Generate a JAR file for archiving.

javadoc task

Javadoc type task. Generate Javadoc.

reference

This article is written with reference to the following books.

Reference book: Thorough introduction to Gradle Building an automation platform with next-generation build tools

Recommended Posts

[Gradle] About Java plug-in tasks
About Java interface
[Java] About Java 12 features
[Java] About arrays
Something about java
Where about java
About Java features
About Java threads
[Java] About interface
About Java class
About Java arrays
About java inheritance
About interface, java interface
About List [Java]
About java var
About Java literals
About Java commands
About Java log output
About Java functional interface
Java, about 2D arrays
About class division (Java)
About [Java] [StreamAPI] allMatch ()
About Java StringBuilder class
[Java] About Singleton Class
gradle tasks Japanese translation
About Java method binding
[Java] About anonymous classes
About method splitting (Java)
First gradle build (Java)
[Java Silver] About initialization
About Java Array List
About Java Polymorphism super ()
About inheritance (Java Silver)
About Java String class
About Java access modifiers
About Java lambda expressions
About Java entry points
About Java 10 Docker support
Personal summary about Java
[Java] About enum type
All about Java programming
About java abstract class
Java multi-project creation with Gradle
What I researched about Java 8
About an instance of java
What I researched about Java 6
THETA plugin development (about theta-plugin-sdk)
Spring + Gradle + Java Quick Start
About Java variable declaration statements
What I researched about Java 9
[Java] About try-catch exception handling
About Java class loader types
Control tasks performed in Gradle
[Java Silver] About equals method
[Java] About String and StringBuilder
What I researched about Java 7
About Alibaba Java Coding Guidelines
About Java class variables class methods
About Java Packages and imports
Using Docker from Java Gradle
About abstract classes in java