Java Reference
In-Depth Information
mind. Maven is a very opinionated framework, and customization is done through plugins.
Ultimately, in Maven the build file is written in XML. Gradle is all about customization,
and because the build file is written in Groovy you have the entire power of the Groovy
language available to you.
That fact that Gradle build files are written in Groovy doesn't limit it to Groovy projects,
though. If your Java project is in fact written in Maven form and has no external depend-
encies, here's your entire Gradle build file:
apply plugin:'java'
Applying the Java plugin defines a whole set of tasks, from compile to test to JAR. If that
one line of code is in a file called build.gradle, then just type gradle build at the com-
mand line and a whole host of activities ensue. If you're (hopefully) going to do some test-
ing, you'll need to add a dependency on JUnit, or even Spock. The resulting build file is
shown here:
Now running gradle build results in a series of stages:
:compileJava
:processResources
:classes
:jar
:assemble
:compileTestJava
:processTestResources
:testClasses
:test
:check
:build
Search WWH ::




Custom Search