Archive for August, 2007

Since I recently fell in love with Maven 2 I’ve been looking for ways to integrate this great tool as tightly as possible into my development routine. What I wanted was to manage all project configuration information through maven and just have my java IDE of choice - eclipse - pull all project related information from pom.xml.

My first stop was the maven-eclipse-plugin which you register in your pom.xml as plugin to maven and then by issuing a “mvn eclipse:eclipse” generate all eclipse project information from there. Initially everything was looking good, until I actually tried to run my test web application in Tomcat from within eclipse. The web application came up just fine but failed to resolve any references to the business logic project it depended on. After a while I figured out that maven-eclipse-plugin is able to reflect inter project dependencies into the generated eclipse project files - which makes a build in eclipse complete without errors - but what it is unable to do is to mark those dependend project outputs for inclusion into the deployment process (ie add them to the J2EE Module dependencies). Of course the work-around would be manually check the J2EE Module dependencies for those projects but that would defeat the intial purpose of managing everything through maven. While googling for solutions I stumbled over this ancient thread which explains the problem in all it’s glory.

Enter m2eclipse which works quite opposite to the maven-eclipse-plugin since it is an eclipse plugin rather than a maven plugin. Seems to do what it is supposed to do, namely solving the problem with the J2EE Module Depedency by introducing it’s own classpath container to eclipse which encapsulates all maven artifacts. What I’m currently missing is the ability to bootstrap a project solely using maven because m2eclipse lacks (to my knowledge) the abilty to generate or import pom.xml into eclipse. Nonetheles I think I’ll stick to it for the time being.