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.
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.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.
Whip out those weird instruments of science and probe away! I think it's a tiny ad: