You are here
Home > Guest Column > Cheatsheet: Different Project Building Tools in Java

Cheatsheet: Different Project Building Tools in Java

In my previous post I discussed about java based web frameworks that are commonly used these days. Similar to the different web frameworks evolution over the period, there are also many building tools which have evolved over the period from the first building tool Ant.This post is all about a quick introduction and comparison of different building tools available in java.

What is Ant?

ant

  • Ant is considered to be a build tool only.
  • Ant does not have a common project directory structure so the folders and targets are manually defined as ant task to run.
  • Ant is completely procedural i.e you have to tell ant to compile, build and compress the sources if needed.
  • Ant Scripts are not reusable.
  • Ant does not have life cycle.we have to manually define goals and goal dependencies.
  • Dependency jars are added manually and also checked into source server also.However Ant + Ivy handles dependencies in agile manner with simplistic configuration.

 

Example Ant Buildfile

<project name=”MyProject” default=”dist” basedir=”.”>

<description> simple example build file </description>

<!– set global properties for this build –>

<property name=”src” location=”src”/>

<property name=”build” location=”build”/>

<property name=”dist” location=”dist”/>

<target name=”init”>

<!– Create the time stamp –> <tstamp/> <!– Create the build directory structure used by compile –> <mkdir dir=”${build}”/> </target>

</project>

What is Maven?

maven

  • Maven is a build tool as well as a project management tool.
  • Maven contains a project directory structure based on the archetype selected while creating project.
  • The real potential of maven is to manage the dependencies.After declaring the dependencies it downloads those and add it to class path.
  • All the tasks are declarative and maintained in pom.xml.
  • Maven goes through a life cycle  i.e if we run ‘mvn install’ on the project,Maven compiles using maven-compiler plugin and put the byte codes in target folder(src\main\target) and create Jar or WAR etc based on packaging in POM.
  • Maven plugins are re-usable.

Example Pom file

<?xml version=“1.0” encoding=“UTF-8”?>

<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd“>

<modelVersion>4.0.0</modelVersion>

<groupId>com.devglan</groupId>

<artifactId>spring-boot-example</artifactId>

<version>0.1.0</version>

<dependencies>

<dependency>

<groupId>org.springframework</groupId>

<artifactId>spring-context</artifactId>

<version>4.2.3</version>

</dependency>

<dependencies>

</project>

What is Gradle?

  • Programmatic execution of build through API agnostic of test framework.
  • Inspection of build outcome and output (e.g. result of build, standard out/error, executed tasks etc.).
  • Cross-version compatibility testing.
  • Debugging the build under test from the IDE

What is Jenkins?

jenkins

  • Jenkins is an open source contineous integration tool written in Java. The project was forked from Hudson after a dispute with Oracle. Jenkins provides continuous integration services for software development.
  • Jenkins is a server-based system running in a servlet container such as Apache Tomcat.
  • Jenkins main advantage is in the number of plugins and community support. Most of the plugin developers are moving to jenkins so Jenkins is more accepted by the community, more vibrant and dynamic.
  • Jenkins is cloud enabled.

What is Hudson?

hudson

  • Hudson is a continuous integration (CI) tool written in Java, which runs in a servlet container, such as Apache Tomcat or the GlassFish application server.
  • Hudson is fully open-sourced under the MIT License.
  • Hudson is oriented more toward enterprise organizations. Additional effort is put to clean the code, stability and performance.

 

Dhiraj Ray
Dhiraj is Sun Certified Java developer. He is a technology savvy professional with exceptional capacity to analyze, solve problems, and multi task. He loves blogging and spends most of the free time in learning and implementing new technologies.
http://www.devglan.com
Top