Builds with Gradle, Buildr, Maven, and Ant
We’ll be looking at identical builds for three build tools: gradle, maven, and buildr. There are no differences between the project file structures, only the build directive files were different.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
The “test project” was a simple Newton-Raphson implementation for calculating square roots, with one interface, one implementation (using 1.6’s “@Override” in the implementation), and one TestNG test; the goal is to show a simple project with a TestNG dependency. Other dependencies shouldn’t change the build files much.
This is our baseline project configuration, and should represent a close minimum of a Maven 3.0 pom for a project with a dependency on JDK 1.6 and TestNG. It will use the most recent version of TestNG that it is able to find (which is the “[5.14.0,)” version number in the TestNG dependency block.) The file will normally be named pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
The project is built with “mvn package”. It gives a deployable artifact, called “com.mayhewr.nr.maven-1.0.jar” (the rest of these yield “nr-1.0.jar” files.)
The equivalent gradle configuration file (build.gradle) would look like this:
apply plugin: 'java'
testCompile group: 'org.testng', name: 'testng', version: '5.14+'
The invocation command line is “gradle assemble”.
Buildr’s build file is “buildfile”; the project definition looks like this:
repositories.remote << 'http://www.ibiblio.org/maven2'
define 'nr' do
compile.using :source=>'1.6', :target=>'1.6'
The invocation command line is simply “buildr package”.