What Is Ant, Really?

Ant is a bit of a mystery bag. Its behavior is often obscure until you come to look at its code. Then you find that it consists of a number of fairly simple facilities that are often explained from a bottom-up detailed and technical viewpoint and not from a top-down architectural perspective. This article aims to provide the missing top-down view. It is targeted at an audience of software engineers. Armed with this article, and some solid opinions on when and when not to use this tool, you should be able to find your way in the anthill.

Ant History, Legacy, and Impact

If you have never heard of Ant, don't worry. Ant is yet ANother Tool in the realm of building software. It was the first attempt at a build tool for Java. When it was conceived, XML was all the rage, and C was the way to express software that Java mimicked. Consequently, Ant was influenced by the thinking of C's make tool. Combining these two trends, Ant is a curious hybrid that does not have make's terseness or stringent reproducibility but does have XMLs verbose syntax. Talk about the best of both worlds.

Hibernate Example

In this tutorial, you will see how to persist the Java objects using the Hibernate Object/Relational Mapping (ORM) framework. Hibernate automates ORM and considerably reduces the number of lines of code needed to persist the object in the database. This example demonstrates how to automatically generate code from the object/relational mapping file, thus saving the developers time. This helps the developers focus on the business problem rather than doing repetitive coding work.

Hibernate uses an XML document or the properties file to define the object/relational mapping. The object/relational mapping file contains the mapping between the Java object and the corresponding database table. This example illustrates how to create the ORM using the XML document.

Spring MVC Framework Tutorial

Spring MVC helps in building flexible and loosely coupled web applications. The Model-view-controller design pattern helps in seperating the business logic, presentation logic, and navigation logic. Models are responsible for encapsulating the application data. The Views render a response to the user with the help of the model object. Controllers are responsible for receiving the request from the user and calling the back-end services.

The figure below shows the flow of requests in the Spring MVC Framework.

Running Cucumber With Maven

A little while ago (ok, maybe in the distant past), I started writing about Cucumber. My very first post detailed how to set up Cucumber JVM, and we’ve come a long way from then. I thought it was worth revisiting, as there are simpler ways to get set up, and better tools out there to use. So with that, let’s dive back in!

Build Tools

Previously, I was setting up the project by manually identifying and downloading each of the required jars into a lib directory. That is so last decade to do things. What we should be doing is orchestrating and controlling these dependencies with a build tool.

Starting With Apache Maven

Apache Maven is a build or a total project management tool that scores over its predecessors such as ANT for Java builds with the following advantages:

  • Useful when multiple JAR files are required for builds
  • Resolving recursive dependencies during build time
  • Creating project structures that are standardized
  • Building, publishing, and deployment of applications
  • Supports lifecycle of an application along with plugins

I have created an alumni project that is a dynamic web archive with a Servlet that says “Hello, Alumni”.