Friday, April 14, 2006

Using Maven2 to Build J2EE Application in a Corporate Environment

Maven2 is a great building tool, but using Maven2 is not easy since the lack of document make it not user friendly, Timothy M. O'Brien, who co-wrote the book Maven: A Developer's Book, just wrote a blog entry Maven Project Info Reports Considered Dangerous talking about some difficulties a developer will encounter when trying to use Maven2.

Right now, as developer, I'm trying to set up a new build process using Maven2 for our development group in the coming projects. I'll try to document and share some tips, work-arounds and maybe the issues related to Maven2.

In general, to make Maven2 successfull in a Corporate Environment, we need some guidelines or best practices in the following areas:
  1. Building and Managing a Internal Remote Repository shared among developers
    (Note: The two very useful documents I saw on the Internet are Corporate https maven2 repositories and Using Maven in a corporate environment)

  2. Optionally set up a Maven-Proxy inside Firewall to ease the access to central Maven2 Repository at Ibiblio

  3. Developing RAR, WAR, EJB Archetype or Project Templates for common J2EE Component Projects
    (Note: So far, the Maven2 ArcheTypes posted on Maven2 Repository and MyFaces ArcheType are all single project based ArcheTypes, which means that each archetype only generates one pom.xml)

  4. Write or customize Maven2 Plug-ins for your own building process

  5. A Typical J2EE Application Project Layout or Directory Structure

  6. Continuous Integration with Nightly Build and Reports

  7. Caveats and Workarounds:
    7.1 How to exclude Maven Property files such as pom.xml and pom.properties in the generated JAR, RAR, and EAR File

    7.2 How to set the RAR File name through the pom.xml

    7.3 Maven2 ArcheType Plug-in did not recognize internal remote repository
In the last three weeks, I already spent a lot of night time browsing through Maven Web site, articles, blog entries, Maven Mailing List to gain some knowledge in the above areas. I'll update this blog entry with more Maven2 related detail when I make progress with my project in these areas.