Wednesday, August 27, 2008

Ant and Maven

You write Java and you don't know ANT? You must live under a rock. Everybody uses it. It is open source, downloadable from Apache.

Gimme a break, if it is on Apache, I must use it? Then you will forever be slave to open source libraries.

It is a strangely named tool "A Neat Tool"

This is Java's makefile, in the form of XML (and you must call it build.xml). People use makefiles for decades. Instead of the classic (but arcane) C/C++ makefile with tabs, ANT uses XML. Yes, every new tool is required to embrace XML. ANT essentially calls your javac.exe and you can write batch-file like commands to make jar files out of your compiled files the way you want it.

But I am not so comfortable with the "everyone is using it so you must know it". *I* decide to use it or not. Ancient C/C++ tools create makefiles too, automatically. Programmers should not worry to much about making builds. I want to check files into the source control and let another person worry about builds.

Enter Maven: industry's new favorite of creating builds. Instead of starting a build.xml from scratch, you can run an arcane command to create a project. (See this 5 minutes guide). Then viola, it can make builds, wow, even create some junit testing code for you. It needs another must-be-called pom.xml configuration file. I have huge complain about the long arcane command in creating the project. The console spits out all sorts of messages that it wants to download download download stuff (patches?). And it gives unintelligentable error if you have a proxy but didn't set it right.

Look folks, any program, open source or not, need to give intelligentable error messages!

The end result is that it creates some directory, a Hello World file, and a JUnit for that. Everyone embraces JUnit Test, and I find it ultra hassle, good that someone cranks those out to satisfy shallow guys who actually think JUnit makes you write better code.

I like Websphere's File->Export to create EAR/JAR, and automatic build.

No comments: