The Artima Developer Community
Sponsored Link

Java Buzz Forum
Why use Maven?

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Warner Onstine

Posts: 242
Nickname: warnero
Registered: Aug, 2003

Warner Onstine is Java programmer and writer of two tech books
Why use Maven? Posted: Aug 4, 2004 2:29 PM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Warner Onstine.
Original Post: Why use Maven?
Feed Title: BlackBox
Feed URL: http://warneronstine.com/blog/tech/java/?flav=rss
Feed Description: BlackBox - Blog on Java, OpenSource, OS X, Movies, Restaurants and other things.
Latest Java Buzz Posts
Latest Java Buzz Posts by Warner Onstine
Latest Posts From BlackBox

Advertisement

People are continually asking me why I use Maven instead of Ant for my projects. Recently I was handed a contract to work on putting a Tapestry front-end to Spring-based app (they already have Spring MVC but they were looking for someone with time to code and who has expertise with their preferred front-end). The example app I was given was based on AppFuse, which I had a looked at previously. This app was also using an extremely complex Ant build file which had several ant files included in it's headers and made extensive use of XDoclet to build all sorts of things.

Initially it took me an hour just to get the app built (I had previously gotten the normal AppFuse up and running in about 15 minutes). This was because I had to track down where in the Ant file they were calling the right SchemaExport for HibernateHibernate and what was causing it to blow up. They had somehow forgotten to include the actual class files in the SchemaExport call, not sure how that happened.

Next up, I needed to figure out where in the world the web.xml file was, cuz it wasn't anywhere that I could find. I finally figured out that they were using XDoclet to build the web.xml from xml fragments. "Finally!" I thought, "Down to business". So, I added in the requisite pieces, now to add in the needed jar files. Mmmmm, ok, found the lib directory, which is scattered with folders like:

pmd-1.2
postgresql-jdbc-7.4
...

And there's a lib.properties file sitting there also, so I open that up and it's got a bunch of

postgresql.version postgresql.dir
to specify what directory what jar file is in. I go ahead and fill all that info in, which takes a good 15-20 minutes on it's own (if I had used maven, I could've dropped in all that lovely stuff in about 1.5 minutes, because I already have a project using Tapestry).

Next, I had to find out how they were including the libs into the web build process. Of course it's a mix between grabbing everything in the directory and one jar file in a particular lib directory. Added in all the naughty bits I need and voila! Something that all told should've taken me an hour has now taken me 2 - 2.5 hours.

If this project had originally been setup with Maven, I:

  • Probably wouldn't had any problems with getting the app up and running in the first place
  • Wouldn't have had to dig into someone else's idea of a build file, but just run some simple searches in 2 files (project.xml and maven.xml)
  • Could've copied over my existing project dependencies from another project to add in the needed libraries
Don't get me wrong, I'm not knocking the original developers of this, their Ant file is probably o 1000 ne of the better ones I've run across, but uggh. Why would you put other developers through this? I certainly can't see the client or his team being able to maintain this spaghetti anytime soon.

I don't want this to be a flame war or anything, but I just felt this to be a perfect example of why I use Maven, and why I recommend it. It's not without it's faults, but I personally can live with them for the time being.

Read: Why use Maven?

Topic: Annotations are not for configuration Previous Topic   Next Topic Topic: OO-Matron

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use