julian
julian

Reputation: 129

Maven integration into eclipse, Problems with Dependencies vs. Referenced Libraries

he fellas, i need your help again.

Im trying to develop a new part for an existing software. The parts are all done using Maven. I have to work in several projects at once, which are all continously opened in Eclipse. In Eclipse i use M2E, but i tend to edit the poms directly in xml. So, now I can build (clean install) the projects individually, works ok. But Eclipse now has problems with the online help: It shows me errors. Eclipse cant seem to see classes which are placed in the same project, but different packages. Note that it works fine when i compile it! Also after I run the pom the dependencies dont show up as "Maven Dependencies" but as "Referenced Libraries". This persists after I run mvn eclipse:eclipse from outside and refresh.

Thanks so much for your help!

Upvotes: 1

Views: 2280

Answers (4)

Asen Kolev
Asen Kolev

Reputation: 41

I agree with kisna. As an alternative to fix the project if already contains both "Referenced Libraries" and "Maven Dependencies", you can do the following:

https://docs.oracle.com/cd/E14545_01/help/oracle.eclipse.tools.weblogic.doc/html/j2eelib/operations/opRemoveLibRefFromClasspath.html

Right-click on the project and select Properties -> Java Build Path -> Libraries tab -> Find the entry in the list of libraries called Shared Library [] or/and all libraries that starts with 'M2_REPO/', and then select it/them and remove.

Upvotes: 0

kisna
kisna

Reputation: 3127

"Do not ever do mvn eclipse:eclipse", only do mvn eclipse:clean from command line first and then import "as maven projects" using your eclipse M2E plugin.

M2E Plugin knows how to handle Maven Dependencies, whereas mvn eclipse:eclipse knows how to handle Referenced Libraries, and they are NOT compatible with each other. You can always do mvn update project in Eclipse after mvn eclipse:clean.

Upvotes: 2

feder
feder

Reputation: 1795

I had to delete the maven-project, too, after using eclipse:eclipse. It added the references as "Referenced Libraries".

Manually deleting the .project and .settings files in the project folder and importing the project again helped. I used the M2E import. Afterwards it displayed the libraries within the "Maven Dependencies". Subsequently I was able to run it on my local webserver.

Upvotes: 2

julian
julian

Reputation: 129

I do not really know the reason for the behavior, but deleting the project and reimporting it solved it.

Upvotes: 0

Related Questions