Java Reference
In-Depth Information
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:jar
:assemble
:compileTestJava UP-TO-DATE
:processTestResources UP-TO-DATE
:testClasses UP-TO-DATE
:test
:check
:build
BUILD SUCCESSFUL
Each word after the colon is a Gradle task . Gradle constructs a Directed Acyclic Graph
(DAG) out of the specified tasks, paying attention to their dependencies, and then executes
them in order. This minimal project has no source code, so the compile tasks are up to date
without running at all. In fact, the only task that does anything is the jar task, which cre-
ates a JAR file in the build/libs directory.
If you're doing any testing your project will need to include the JUnit dependency. Con-
sider a simple project that uses standard Maven structure, so that any Java classes are con-
tained in src/main/java, and any tests are in src/test/java. The next listing shows a POJO
called Greeting with a single String property called message .
Listing 5.14. A Greeting POJO to demonstrate a Gradle build
public class Greeting {
private String message = "Hello, World!";
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}
The following listing is a JUnit test called GreetingTest , which checks the getter and
setter.
Search WWH ::




Custom Search