> 
> Scenario 2: If say initially we were using Ant as the building tool for
> a
> project. Now we want to use Maven as the tool , how do we implement
> that?
> What is the process of migration from ant to maven?
> 

Let me try and answer this a little more directly.

The first thing is to have a good understanding of the ant build. If you 
already have this, you are way ahead. I have helped out teams which had little 
to no understanding of their ant build as it was put in place years before and 
now works and no one wants to touch it. Hopefully, you are better off.

Next, you need to have a decent understanding of Maven. Maven isn't just a 
build tool. It is much more than that. You may have to do some reading here.

Then you can decide on two basic approaches:

1. Perform an ant build and look at the final artifact(s) that your build 
produces.  Then work backwards and change your build such that maven produces 
virtually the exact same artifact(s).

2. Start with the source and figure out how to build it using Maven.  I view 
this as a forwards approach.

I personally like to focus on the former rather than the latter, however 
realistically you will want to a mix of both.

Here are some of the big obstacles I have seen cause teams the most grief:

1. The final artifact built with Maven may not look EXACTLY like the one you 
build with ant. This is because you can do some pretty funky things with ant 
that are very difficult to do with Maven (and greatly frowned upon). For 
example, I have seen a number of ant builds copy .class files from one location 
to another and package those same .class files in separate jars.  This is very 
much frowned upon when using Maven. The approach with Maven is to take the 
.java files from which those .class files are compiled and move them to their 
own maven project and build those .java files in their own jar.  .class files 
should not be duplicated between jars. Trying to do this with Maven will be 
very very awkward.

2. Your final artifacts built with Maven will likely be MUCH bigger than the 
ones built with ant. At least at first. This is because Maven handles 
transitive dependencies automatically and will pull in these jars for you. In 
ant, you have to reference these dependencies explicitly.  You can of course 
take control of what dependencies you include using maven, but it will take 
some effort on your part to understand what artifacts you don't need and why.

3. With ant, you can introduce circular dependencies between jars. For example, 
jar A can depend on jar B, and jar B can depend on jar A. Again, greatly 
frowned upon and you will likely get a circular dependency build error 
converting this kind of structure to Maven.

If you are intimately familiar with your current ant build you may be able to 
identify some these obstacles up front.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to