Quick Introduction to Build Tools

This post will give a quick intro to build tools - Maven and Gradle

Pavan Kulkarni

2 minute read

In this post we will look at a basic introduction to build tools and a few distinguishing factors between widely used build tools.

What are build tools?

Build Tools are programs that create executables from source code. The build tool facilitate in

  1. Downloading and linking dependencies.
  2. Compiling the source code
  3. Running unit test cases (if any)
  4. Packaging the source code into executables (.jar, .exe etc)
  5. Deploy to production.

Why do we need Build Tools?

Developers can perform these activities manually in a small application. But as the application scales, it becomes rather cumbersome to perform these activities manually. In certain larger applications, we need to specify the flow of module. Such rules can be defined in Build Tools. Scripts can be written to automate the above steps using Build Tools to avoid manual effort by developers.

Examples of Build Tools

The most widely used Build Tools are:

  1. Ant
  2. Maven
  3. Gradle

Build Tool Installations

  1. Install Maven
  2. Install Gradle

Advantages and Disadvantages of Gradle over Maven.

Advantages

  • Simple to configure.
  • Groovy makes scripting easy and readable.
  • Dynamic dependency set
  • Works with Maven Repositories as well
  • Defining sequence of execution is easy.
  • In a multi-module project or micro service architecture, defining incremental build is straight forward.
  • As claimed on the official website, Gradle is faster than maven.

Disadvantages

  • Not as many plugins available as for Maven
  • Learning curve is hight for Groovy
  • Poor integration with Eclipse
  • Slower than Maven

Note :

Using Maven or Gradle is a personal choice and the type of project you have. Setting up either of them can be as simple or as pains taking as you can imagine. In my future posts, you will see me working with Gradle extensively.

References:

  1. https://maven.apache.org/
  2. https://gradle.org/
  3. https://en.wikipedia.org/wiki/List_of_build_automation_software
comments powered by Disqus