Thursday, March 10, 2011

ZIP Files - Ant and Maven

How hard it might be to ZIP a bunch of files you think right? Judge for yourself. Like in my previous post of getting the timestamp, I needed to ZIP all the source artifacts to upload to a server.

I could do this in one line in Ant. Yes, literally one line.

Now comes the fun part. Doing the same with Maven. Started browsing the Maven site to see what needs to be done to achieve the same. Sounds easy though, but the XML configured for such a fairly trivial task was not a 1 liner. Several lines to get this to work.

Not sure how many more things I will uncover using Maven. I would have written everything in Ant and asked the client to use the Ant plug-in for Maven, but that is not an option I have.

I am glad I am learning so many things about Maven. By the time I finish writing all the plug-ins for Maven, I am quite confident I will be able to say I am a Maven GURU. Hope that day comes soon.


  1. TO jar up your source artifactsAND publish them when you run install or deploy you can also use the snippet below:


  2. Instead of modifying the pom file, you could always use the command-line switch source:jar
    mvn package source:jar

  3. the issue with ant rises when it is combined with many other commands and ends up becoming something only the original dev understands

  4. When I wanted to use Maven in our project some time back to replace Ant, I felt the same way.. They have built a Rocket and all we need is a Car !!!

    Ant simplified Build and Maven is making it complicated once again.. Go with Ant and Ant Ivy...

    Sanjay Melinamani