There is too much controversy of moving from Ant to Maven, but maybe people don’t know that ant build scripts can be used with maven.
These are the step by step instructions:
- Create a minimal project.xml, that we’ll call POM (Project Object Model) or project descriptor. The most tedious task will be adding the dependencies needed to compile your classes, but you can use this search tool to get groupId and artifactId for them. If any of that dependencies are not at ibiblio repository copy the url of the repo, you’ll need it later. Change sourceDirectory to suit your needs.
3 yourgroup yourjar hibernate hibernate 2.1.6 springframework spring-core 1.1 src/java
- Create a file maven.xml. This is the place to write ant scripts. You just have to rename targets to goals. You can get the current dir using ${basedir}.
<?xml version="1.0" encoding="ISO-8859-1"?> <project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:maven="jelly:maven" xmlns:util="jelly:util"> <goal name="doSomething"> <!-- do some stuff using ant scripts --> <delete dir="${basedir}/adir"/> <mkdir dir="${basedir}/adir" /> <copy todir="${basedir}/adir"> <fileset dir="${basedir}/anotherdir"/> </copy> </goal> </project>
- If you use some dependency not at ibiblio create a
project.properties
file with a linemaven.repo.remote=http://www.ibiblio.org/maven,http://cvs.apache.org/repository
where http://cvs.apache.org/repository is the url you copied early. You can add as much urls as you want, separated by commas. - Now you can run
maven doSomething
to execute the ant goal, and you can also callmaven java:compile
to compile the classes,maven site
to generate a good looking website,… - A common complain of Ant users is speed. You can call
maven doSomething java:compile
to run both goals or usemaven console
, where ypu can type any goal without the startup penalty time. - Now you should be ready to check maven reference docs to explore the lots of features that maven can offer.
To sum up you can do with Maven everything you can do with Ant and many more things, so why don’t give it a try?
I could not agree more. Why the controversy?
Maven does everything ant can do. In fact it uses the Ant tasks, plus it does much much more.
Maven can really mitigate Jarmaggedon!
To me using Maven is a no brainer.
One thing that kills me at Maven is that tens of downloads it tries everytime. If it will be able to run out-of-the-box I would happily give it a more attentive try.
./the_mindstorm
One thing that kills me at Maven is that tens of downloads it tries everytime. If it will be able to run out-of-the-box I would happily give it a more attentive try.
./the_mindstorm
Sorry for posting twice, but I think it may be a bug of jroller (after a while a have done a reload and oops it appeared twice).
Again sorry,
the_mindstorm
Magic from Apache’s Avalon project may be the best of both worlds.
Re: the_mindstorm
It doesn’t try to download the same everytime, just when needed and the same jars are not redownloaded. And it does it for you, if you wan to do the same things you do with Maven you’d have to download by hand.
Re: Magic
I don’t see future for Magic. Maven has a very strong position in the community.
wow, I beg to differ. I just looked at Magic and I was *really* impressed by it. It seems like everything maven should have been. Let me add that I think Maven/Jelly is great and was ahead of its time, but its kitchen-sink philosophy makes it not very practical for a lot of projects.