A build tool named Gradle – Part 1
Introduction to „Build“
Well, if we talk about software development, we often think about drawing class diagrams or implementing classes. But an important part of creating new software is the build process. Most software doesn’t comprise only of source code, but rather there are external files such as scripts, property files, readmes etc. These files should get delivered with your software package. Furthermore, you have to compile, test, package and deploy your software. But I don’t think that you want to do that manually each time you change something. This is where build tools come into play. You have to write a build script that does these steps automatically, so that you only have to hit the “Build” button and get an executable software.
Common build tools
Okay, you decided to write your own build script for your Java code. So you google “build tool java” and you found out, that there are plenty of fish in the sea. But I think the most common used build tools are Ant, Maven and as the topic indicates Gradle. These are all open source tools which are provided by Apache respectively Gradle is provided by Gradleware. All of them use the same dependency management tool: Ivy.
Let’s say you have a simple piece of software which you want to ‘build’. Your software has a dependency on a jar-file named ‘junit-4-11.jar’ because you want to test your software with some JUnit tests each time you change something within your software. And of course, you want your software to be executable as a jar file. So let’s sum up the steps mentioned above: (By the way: these are some typical steps of a build process.)
- Download the dependency: junit-4-11.jar
- Compile your Java classes
- Run the JUnit tests
- Build an executable jar
With the introduced build tools you are able to automate these four steps. But each of these tools is working in a different way. Well, what is the best tool for your work? It depends! For each tool there are pros and cons which I want to elucidate in the following table:
I will illustrate the pros and cons, especially these between Ant and Gradle in my upcoming blog posts.
Summing up you can say that ‘build’ is a kind of automation of necessary steps, that you need to complete your software. A build tool provides opportunities for software developers to create a pretty piece of software. With a good build process you can focus your work onto your source code instead of thinking about how to package and deliver your application.
What is coming next in Part 2
In the second part of my blog post, I want to introduce Gradle in detail. I will show you the usage and point out the advantages of this build tool. Furthermore I will explain some code examples of my Gradle code.
If I have drawn your interest you also might want to inform yourself about Gradle, have a look at the homepage and the user guide:
Gradle Homepage
Gradle User Guide
Read on: A build tool named Gradle – Part 2
– René
Recent posts





