Two Laptop Bag*
The moose likes Ant, Maven and Other Build Tools and the fly likes javaee: eclipse + maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "javaee: eclipse + maven" Watch "javaee: eclipse + maven" New topic

javaee: eclipse + maven

Denis Zjukow
Ranch Hand

Joined: Mar 15, 2006
Posts: 39
Hello! I got a problem. We are currently starting a new javaee project (war + ejb, so we package it as an ear module). We want to use eclipse as an IDE and Maven as a build tool. We also want to use eclipse automatic build and deploy as it is very useful for development. The problem is that I haven't managed to use 'automatic build and deploy' feature, as maven and eclipse use different project layouts (I had an error when tried to deploy ear module to server (JBoss AS 4.2)). We've already used maven with eclipse for a web project (war module), and want to use same tools for this new project. So my question is: is it possible to adjust eclipse so that we could make builds with maven and still use automatic build and deploy. I've tried 'mvn eclipse:eclipse -Dwtpversion=1.5' but it seems it didn't solve the problem. Please help!
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950

Actually, one of the nice things about Eclipse is that it doesn't force you to use a specific project layout. The only thing different about Eclipse projects is that it adds 2 files: .project and .classpath, which define the project characteristics and the Java build classpath (assuming a Java project).

The Maven eclipse goal will use the POM as a reference point to build the .project and .classpath files ("Mavenize" the project). That's all it does. There's a similar goal for IntelliJ support.

For best results, you should have a Maven plug-in installed in Eclipse. If you are using the default Eclipse automatic rebuild feature, you could be having trouble where Eclipse rebuilds all or part of the output folders without being properly aware of Maven's use of those folders.

Customer surveys are for companies who didn't pay proper attention to begin with.
Denis Zjukow
Ranch Hand

Joined: Mar 15, 2006
Posts: 39
Thanks for your explanation, Tim. Could you please tell me what particular Maven plugin you install?
Denis Zjukow
Ranch Hand

Joined: Mar 15, 2006
Posts: 39
Actually, I found what was my problem with EJB project (Eclipse threw an IndexOutOfBoundsException after I tried to deploy my EAR module containing an EJB module). As a matter of fact, I generate project settings using Maven Eclipse Plugin. It turned out, there is an open issue (MECLIPSE-196) in Maven 2 Plugin JIRA. However, the defect is not fixed yet. There is some mysterious workaround, unfortunately, I am not an expert in Eclipse development, so I haven't managed to apply the described solution on my machine. If anyone faced this problem and found a way to solve it, please share your knowledge. Any information about this problem is highly appreciated. Thanks...
[ June 24, 2008: Message edited by: Denis Zjukow ]
It is sorta covered in the JavaRanch Style Guide.
subject: javaee: eclipse + maven
Similar Threads
Ear module redeployment with maven and glassfish 3.1
How can I get Eclipse, Maven and Glassfish work together while developing?
eclipse galileo + m2eclipse + enterprise application
Continuous integration - Bamboo, Maven
Multi module hot deployment with maven