File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Libraries not visible under projects java build path  in eclipse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Libraries not visible under projects java build path  in eclipse" Watch "Libraries not visible under projects java build path  in eclipse" New topic
Author

Libraries not visible under projects java build path in eclipse

Shane Lee
Ranch Hand

Joined: Mar 19, 2005
Posts: 63
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

Joined: Mar 19, 2005
Posts: 63
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

Joined: May 14, 2008
Posts: 5823
    
    7

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.


JBoss In Action
Shane Lee
Ranch Hand

Joined: Mar 19, 2005
Posts: 63
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

Joined: May 14, 2008
Posts: 5823
    
    7

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Libraries not visible under projects java build path in eclipse