Build Automation

ANT:
Ant was the first build tool released in 2000.
Ant was developed on procedural programming idea.
Ant was improved with an ability to accept plug-ins and dependency management over the network, with the help on Apache-IVY.
Drawbacks:
1) XML is used as a format to write the build scripts.
2) Being hierarchical is not good for procedural programming, and
3) XML is relatively unmanageable.
 

MAVEN:
Maven was introduced in 2004.
Maven relied on the conventions and was able to download the dependencies over the network.
Benefits :
Life cycle of Maven, while following the same life cycle for multiple projects continuously.
Problems:
1) Maven does not handle the conflicts between versions of the same library.
2) Complex customised build scripts are difficult to write in Maven, as compared to writing the build scripts in ANT.


GRADLE:
Gradle came into picture in 2012
Features 
Declarative builds and build-by-convention
1) Gradle is available with separate Domain Specific Language (DSL) based on Groovy language.
2) Gradle provides the declarative language elements. Those elements also provide build-by-convention support for Java, Groovy, OSGI, Web and Scala.
Language for dependency based programming
The declarative language lies on a top of a general purpose task graph, which can be fully supported in the build.
Structure your build - design well-structured and easily maintained, comprehensible build.
Deep API -  monitor and customise configuration and execution behavior to the core.
Gradle scales - easily increase the productivity, from simple and single project builds to huge enterprise multi-project builds.
Multi-project builds - 
Gradle supports the multi-project builds and partial builds.
If build a subproject, Gradle takes care of building all the subprojects, that the subproject depends on.
Different ways to manage your builds - supports different strategies to manage your dependencies.
Gradle is the first build integration tool - 
Gradle is fully supported for your ANT tasks, Maven and lvy repository infrastructure for publishing and retrieving dependencies. 
Gradle also provides a converter for turning a Maven pom.xml to Gradle script.
Ease of migration - Gradle can easily adapt to any structure. Therefore, you can always develop your Gradle build in the same branch, where you can build live script.
Gradle Wrapper - Gradle Wrapper allows you to execute the Gradle builds on machines, where Gradle is not installed. This is useful for continuous integration of servers.
Free open source - Gradle is an open source project, and licensed under the Apache Software License (ASL).
Groovy - Gradle's build script are written in Groovy programming language. The whole design of Gradle is oriented towards being used as a language and not as a rigid framework. Groovy allows you to write your own script with some abstractions. The whole Gradle API is fully designed in Groovy language.

Why Groovy for Gradle?
The base syntax of Groovy is same as Java.
Languages like Python, Groovy or Ruby are better for build framework.
The complete Gradle API is designed using Groovy language.
Gradle is a general purpose build tool and its main focus is Java projects.
The reason for choosing Groovy is, because, it offers by far the greatest transparency for people using Java.


Gradle Commands

$gradlew dependencies
- to see used jars and its sub jars details.

$gradlew clean build
- clean build the application

$gradlew publishToMavenLocal
- to generate used jars in .m2 folder in local system, user mavenLocal() to use generated jars.
- in windows, check C:\Users\<username>\.m2\repository\

Intellij IDE Steps:

Vulnerable Analysis:
Right Click -> Analyze -> Analyze Dependencies 
Right Click -> Analyze -> Vulnerable Dependencies

Comments

Popular posts from this blog

PL/SQL

JAVA8 Features