Sunil posted a link to a Maven 1 tutorial. Don't use Maven 1, use Maven 2 (or 3) instead.
The best thing to do is first learn how Maven works, build a few simple projects from scratch using it, and then decide how best to migrate your Ant builds to Maven.
If you read th
e other posts for the last day or two you will already have seen this link to some really good Maven books:
Maven takes the opposite approach and expects you to completely integrate with the Maven lifecycle. Experienced Ant users find this particularly jarring as Maven removes many of the freedoms you have in Ant.
@Peter I saw the Maven book and somehow decided that it wasn't the right start. Now working on the book, building something from scratch to get a feel of things.
But I still feel Maven is too restrictive as compared to Ant.
Yes, that was also the first thing I was thinking, when I had a look at Maven. "Why the heck should I do it the Maven way?" And I was at that time also quite happy with Ant. But in my experience those restrictions are more helpful than harmful. Whenever I check out some sources of an open source project and it's using Maven, I usually just type mvn:compile on the console and that's it. I know the structure of the project and know where to look for the most important files. No need to try to look inside the brain of another developer who is using a structure that he defines "best".
Dependency management CAN get quirky with Maven. Don't know how it compares to Ivy. But all in all I'm quite happy with Maven. First I was hating it, then I was using it and now I'm loving it. Give it a few months a try. You can always switch back to Ant after that, if you feel like.
Use the right tool for the right purpose. Maven is a black box that does many things extremely well, provided you can find a plugin that does what you want. For anything else I use Ant because I can get Ant to do just about anything without having to resort to writing a plugin, and I have used Ant for some fairly strange things (e.g. scheduled backups, building release images of a fairly large software stack).
However, now that I have used Maven, even the Java projects for which I use Ant have the Maven directory structure. Or a slightly modified form thereof. Check out the build scripts for JBoss in Action.
Joined: May 28, 2008
I got a couple of examples from the Maven site up and running but I am still unsure as to how I should go about refactoring an existing project (Eclipse-RAD 7.5) to allow a Maven build.
2 projects, 2 Maven pom.xml files, one in the root of each project. The EAR project should include the Web project as a dependency.
Java code goes in src/main/java. Static web content goes in src/main/webapp, which models the static part of the WAR/EAR. You might want to double-check on the directory structure for EAR, though. Just look for the EAR plugin in the Maven (version 2 or later) docs.
That will take care of the bulk of the mavenization process.
Customer surveys are for companies who didn't pay proper attention to begin with.