I would like to share my experience of moving from "our reinventing wheel" of Ant build scripts to Maven standard. I reworked some apps which have following characteristics:
The apps should be compiled with Java 6 version.
Some of the apps are using Model Driven Architecture/Model Driven Software Development things, it means we have some MDA/MDSD generators inside our Ant scripts, like AndroMDA or oAW.
Almost all the apps use Hibernate, so we need to generate the whole Database scheme to be able to create the whole database automatically.
Some of the apps use older version of ANTLR. So we have some of ANTLR source codes which have to be compiled.
Some of the apps use older version of Groovy. So we have some of Groovy source codes which have to be compiled.
A webapp uses GWT as presentation layer.
Some of the webapps have some kind of information about the version. For example the webapps have version.html file which should be automatically generated with some information like build timestamp, the person who build the app, the description of the app, etc.
The apps or modules should be packaged as war or jar. Additionally they also include some additional information like installation documentation, SQL scripts, etc. which have to be package as a zip file separately.
All of the apps or modules should also package the source codes additionally to the packaged artifacts, so we can debug the apps easily.
The webapps need to package the class files additionally as a separate jar file, so that this can be added as a dependency into another Maven project or module.
The apps have some unit tests in JUnit.
The apps have some integration test for SpringFramework context and database or service methods test in SpringFramework.
JSP files should be precompiled with JSPC from Weblogic.
Quality check: the apps should be quality checked using Emma (code coverage) and CheckStyle (quality of the codes).
The webapps should be automatically deployed to Weblogic.
All configurations should be automatically uploaded to the server.
The database scheme should be automatically upgraded and downgraded.
JRebel rebel.xml file should be automatically generated for chosen projects or modules.
Yes, our Ant scripts can do the (almost) whole things above. You can imagine how complex they are? Yes, everything are in the Ant scripts and you need to turn on/off the features you need. Remember how SAP works? Yes, we call this customizing! This is where I see the power of Maven. The plugin concept is just a better concept. Instead of having everything, we only have a small "core" and we add plugins on the top to fullfil our need. In case of the Ant scripts, you have everything (although you don't need all of them) and then you use switcher to turn them on and off.
So how did I solve the requirements above with Maven? Here they are, the plugins we need! In this article I just want to show you the plugins I used:
Continue read this article at: http://lofidewanto.blogspot.com/2011/06/moving-from-ant-to-maven-best-practices.html
As a conclusion I just can say, Maven and its plugin ecosystem are great. No matter how complex your project you can still handle it easily with Maven plugins. My lessons learned is that DO NOT REINVENTING WHEEL! There are a lot of good Maven plugins out there! In case you cannot find one, just use maven-antrun-plugin. You can almost do everything with it. Just don't forget that you don't want that chaos back to Ant, so use it with precautions.
... and to all other developers who still doing their own build processes... try Maven, you won't regret!
Discussion: so what are your experiences with Maven plugins? What are your favorites Maven plugins?