Posts tagged 'ant'



Built with Maven

Maven Logo

I was a Maven hater and resisted it for a long time but over the years Maven has gotten much better, it's well supported in IDEs and as far as I can tell, Maven has replaced Ant as the de facto build system for Java projects. If you want new developers be able to easily build, debug and run your code via command or their favorite IDE then Maven is the way to go, and that's especially true for open source projects like Roller.

That's why I spent a couple of weekends learning Maven and converting Roller's build process from Ant to Maven (ROL-1849). The process of conversion wasn't too difficult. Getting dependencies under control was a pain, but it believe it will be a one time pain and a worthwhile one. What took the most time was figuring out how to get Maven to start Derby, create the Roller tables and then run Roller's JUnit tests. Also, getting Maven's Jetty plugin setup to run Roller was a little tricky but hopefully also a one-time pain. The result is that Roller now uses a standard and well known directory structure, dependencies are managed and it's easier for developers to get started with the codebase.

If you have Maven and Subversion installed on your computer then these commands will fetch the Roller source code, compile the code, run all JUnit tests and then build the Roller webapp:


   svn co https://svn.apache.org/repos/asf/roller/trunk roller_trunk
   cd roller_trunk 
   mvn install

And once all that is done, the following commands will start the Jetty app server, start the Derby database and start Roller at http://localhost:8080/roller, ready for testing, experimentation, etc.


   cd weblogger-web
   mvn jetty:run-war

I think that's pretty damn useful.

Here are some articles/links that influenced my thinking on Maven recently:

  • Comparing Build Systems - Adrian Sutton concludes that Maven is too much work but "the consistency in how a project is built that the Maven project has brought to the Java would is absolutely revolutionary"
  • Maven in our development process - Sherali Karimov explains how Atlassian and says the need for Maven training is "the most important and most overlooked issue of all."
  • Sonatype - The Maven Company. Founded in 2008 by Jason van Zyl, the creator of Maven. Offers training, support and the Nexus Professional repo manager.