-->

maven integration in eclipse new project checked o

2019-06-16 20:45发布

问题:

I am struggling with maven in Eclipse even though I have m2e.

I checked out a maven project from CVS and cannot navigate anywhere. If I try References > Project, I get a pop up saying:

"Problems opening an editor Reason: services does not exist".

services is the name of the main project, which has sub projects within it. It all builds successfully so I am not sure why Eclipse does not work.

I suspect something related to classpath but have no idea how to edit it since it is not available from the project's properties. I actually tried to manually create a .classpath file but it did not help.

I also converted the project to a maven project but that did not help either.

Any ideas? I am using Eclipse JUNO.

回答1:

I figured out my issue. I had to check out the project from CVS. Then (that's the important part), perform a maven import of an existing project within eclipse. That created maven "ready" projects where I could use all of the IDE's functionality.



回答2:

Yes, you're right. If you import directly from a repository, hovering, linking and opening declarations isn't gonna work. Your solution is right, although another one more direct is use the "File->New->Other->Maven->Checkout Maven Projects from SCM". If then, you have problems because you can't select any SCM type, check Checkout Maven project from SCM - no connectors. If with connectors installed you still have problems: http://forum.springsource.org/showthread.php?102665-SCM-types-not-available-in-Checkout-Maven-Projects-from-SCM.



回答3:

If you have checked out project from svn, project checked out is not generally a eclipse project thats why general functionality of eclipse does not work for the same.

To achieve the same functionality of eclipse like eclipse reader and all other shortcuts,we have to convert the checked out project to eclipse project.

Steps to Convert checked out project to eclipse project:

  1. Right Click on Checked-out Project.
  2. Point to Configure.
  3. Click on Convert to Maven Project.(if checked out project is maven project)

These steps will convert the project to Maven project.

All the eclipse functionality will work for the same.



回答4:

In addition to ensuring that the projects are configured as Maven projects, you may also go to Project Properties (right-click on the project in Package explorer) > Project References, and add projects in the workspace that the selected project may have references to.



回答5:

I had this problem, too. It looks like after a search-in-workspace Eclipse opened a wrong file.

I pressed Strl+Shift+H (Open Type in Hierarchy), typed in the class name, and opened it. The file opened in a new tab, and everything was navigable again.

The difference in icons is: