A task is a single working unit execute in build process. Classic examples inlcude compling the source files, packaging calss files, coping files around, generating documentation etc.
A project has a TaskContainer which contains all the tasks in the project. You can call getTasks method or use project.tasks directly.
A Configuration represents a group of artifacts and their dependencies. The Project class has a member configurations contains all configuration of the project.
In Maven, its called scope, like 'compile', 'run', 'test' etc.
The philosophy of Gradle and Maven is convention over configuration. In Gradle the "convention" object contains these conventions. You can reconfigure these conventions at any time.
The Project interface has a method getConvention which return a Convention object. See Convention
Most features provided by Gradle are implemented by plugins, its fairy easy to create our own Gradle plugins. This post will create a simple plugin in Eclipse.
Our plugin will be built with Gradle, so choose File -> Others, and type gradle
Gradle supports both Java and Groovy projects. When build Groovy project , the best test framework is Spock, when work with Java project, the test framework is JUnit. Even the Spock is actually compatible with JUnit, like Gradle compatible with Maven.
For a typical Java project, the directory layout would be like this
Gradle is a build automation tool for Java and Groovy, its compatible with Maven. Spock is a unit test framework that support Java and Groovy and compatible with JUnit.
In this example we illustrate how to build Groovy project with Gradle and Spock.
If you are using Gradle , you will find yourself in the situation that run gradle build repeatedly.
It takes a few seconds to finish the process, even there is only one file need to recompile. Because before gradle do any real building job, it has to do some initial work like loading JVM, prepare execution environment, loading Groovy classes etc.It takes a few seconds to finish the process, even there is only one file need to recompile. Because before gradle do any real building job, it has to do some initial work like loading JVM, prepare execution environment, loading Groovy classes etc. .
Gradle is a new face in the world of Java build tool. There aren't much book resources available now. But the official document is awful, I am keep looking for in depth books about the subject.
The very first book is "Building and Testing with Gradle". But its a little book and only scratches the surface of the subject.