Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Libraries not visible under projects java build path in eclipse

 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse Galileo: 3.5.0
Apache Maven:2.2.0
JDK1.6.0_11

I am creating a multiple module project using maven externally. My parent project ejb3-enterprise consists of three underlying modules:
ejb3-enterprise-ear
ejb3-enterprise-ejb
ejb3-enterprise-webapp

I want to import my project in eclipse, so i followed the directives in using maven eclipse plugin:
Run command mvn eclipse:eclipse install before importing into eclipse workspace
Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set. Execute the following command:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo

Any time i add a new dependency in pom.xml and run mvn eclipse:clean and mvn eclipse:eclipse and refresh the project in eclipse i can see the classpathentry in .classpath but not in my projects java build path. If i run some tests outside eclipse using maven they run fine even though i have compilation errors complaining about not resolving certain classes im calling in eclipse.

is this down to the version of eclipse im using or why is my project not displaying the new jar files in build path.

Regards,
Shane.
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note:
If i create a single project via maven and import into eclipse i can add dependencies as i please in the pom.xml and maven eclipse will pick them up.
Example:
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is my understanding that using "mvn eclipse:eclipse" has been deprecated. What I would do is use m2eclipse to create new projects and then copy over the contents of the old projects into the new ones. Then use the m2eclipse tools to keep the pom up-to-date.
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Peter,
Maven has a list of available plugins, including eclipse version 2.8 which was released 2010-02-25. So i do not think it is deprecated just not working properly!
See:http://maven.apache.org/plugins/index.html

Maven eclipse plugin actually does have a goal called eclipse:m2eclipse that generates the Eclipse configuration files that are already configured for M2Eclipse. But this does not work either. It still does not recognise my underlying module projects, i would have to create new maven module projects instead from scratch.
NB: You have to revert to maven eclipse plugin version 2.7 to call goal m2eclipse.

Im considering now what is the best way to create an enterprise application project inside eclipse that is maven driven. Any ideas?
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I do is create a new Maven project with the desired archetype. With m2eclipse installed into Eclipse, I do: File | New | Maven | Maven Project and follow the Maven project wizard.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic