Posted on 2 mins read

What is gradle?

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache Maven of declaring the project configuration. (wikipedia)

Here are more build tools from a stackoverflow post linked later:

  • Apache Ant & Apache Maven - Java
  • sbt (Simple Build Tool) - for Scala
  • A-A-P - Python based build tool
  • Rake (Apache Builder) - Ruby
  • Leiningen for Clojure

There is gulpjs and gruntjs for Javascript too.

Gradle and Android Studio

You used to use Eclipse to develop for Android. Later, the main IDE changed to Android Studio and together with it came gradle. Why?

I would say build systems stay true to the way of using commandline programs to achieve some task. This stackoverflow post explains it nicely. Basically, it was difficult for you figure out how to build an apk without Eclipse. Google decided to make an Android plugin for gradle, thus, now its easier to make apks without an IDE. Furthermore, you can customize the way you want your package built. If you like to have resources put in a non-conventional folder, go ahead, just update the build script.

Gradle init

My motivation to use gradle came from the need to test some code or libraries without starting a fully fledged IDE. I discovered a useful plugin gradle has called the Build Init Plugin. (link)

gradle init --type java-library

With then one command I have a basic Java project setup and I can use something like Sublime Text and get going. As a bonus JUnit is included by default.