Earlier I blogged about my recent experiences with Apache Maven, i.e. Apache Maven vs. Apache Ant. Several of the major issues were had were:
- Performance – Maven’s performance (compared to Apache Ant) is horrible. It repeats steps throughout the build (doesn’t skip anything and worse repeats some steps). It’s constantly calling out to the Internet looking for SNAPSHOT’s (per target/goal) as if somehow it magically changed mid-build. A hack for repeated SNAPSHOT searches is to review all dependencies you have to remove as many SNAPSHOT’s on 3rd party components (wherever possible). This isn’t foolproof as some of your dependencies might have dependencies on SNAPSHOT’s. (For the ultimate hack you could tweak all of the POM’s in question but that’s painful and error prone and the next time you update something it could all get blown away.) Another hack is to shut off your Internet connection. The lack of a connection makes Maven stop looking (brilliant).
- Scalability – Maven is a memory hog. The more complex (i.e. more nested components leveraging the reactor) your build process becomes the more memory consumed. Here you need to tweak MAVEN_OPTS environment variable.
I was recently able to make some performance improvements to help Apache Maven, i.e.
- Got a new laptop App MacBook Pro (2.6Ghz, 4 G RAM, HD w 7200 RPM)… not sure what exactly has sped things up but I suspect its the hard drive (as everything else is marginally better, i.e. 0.30 GHz faster CPU, 1G more RAM).
- Tweaked the MAVEN_OPTS
Originally I had the following MAVEN_OPTS settings: setenv MAVEN_OPTS “-Xmx640m” but I was getting errors for “out of perm space” so I used the following MAVEN_OPTS settings:
setenv MAVEN_OPTS “-Xms128m -Xmx640m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=640m -Xverify:none”
But as the number of components were built it locked the system. I suspect the issue is the garbage collection settings. So I reduced the MAVEN_OPTS settings to the following:
setenv MAVEN_OPTS “-Xms128m -Xmx640m -XX:MaxPermSize=640m”
This immediately helped get further in the build process. Eventually it ran out of heap memory so now the MAVEN_OPTS settings are as follows:
setenv MAVEN_OPTS “-Xms128m -Xmx1280m -XX:MaxPermSize=640m” which seems to have done the trick. I’m now able to do complete builds (mvn clean install) with these settings without doing hacks like shutting off my network connections, tweaking POM’s, etc.
But… need to get this working for creating sites, (i.e. mvn site) as well as getting this running with integration tests… (I have quite a few).
In the meantime I’ve been reading the Ant In Action book (which is quite good). I’ve basically re-examined my entire Ant build process (and theory). So I’ve started creating scripts from scratch trying to incorporate concepts from the book, i.e.
- Declaring “beaucoup” ANT properties that can be overridden in a property file (or passed in properties from parent ANT scripts).
- Importing ANT tasks (both life cycle tasks that can be overridden as needed as well as common functionality).
- Potentially leveraging IVY for dependency management.
- Potentially leveraging SmartFrog for deployment management (conceptually cool project).
- Getting JBoss Seam’s testing to work with ANT (shouldn’t be an issue as JBoss Seam uses ANT primarily).
Fingers crossed but making progress…