简体   繁体   中英

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!

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.

"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.

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.

我真的不知道该行为的原因,但是删除项目并重新导入它可以解决问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM