Eclipse 新项目中的 Maven 集成已检出但无法导航
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10484500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
maven integration in eclipse new project checked out but can't navigate
提问by user899757
I am struggling with maven in Eclipse even though I have m2e.
即使我有 m2e,我也在 Eclipse 中与 maven 斗争。
I checked out a maven project from CVS and cannot navigate anywhere. If I try References > Project, I get a pop up saying:
我从 CVS 签出了一个 Maven 项目,但无法在任何地方导航。如果我尝试References > Project,我会弹出一个说:
"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.
services
是主项目的名称,其中包含子项目。这一切都成功构建,所以我不确定为什么 Eclipse 不起作用。
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.
我怀疑与类路径有关,但不知道如何编辑它,因为它在项目的属性中不可用。我实际上尝试手动创建一个 .classpath 文件,但它没有帮助。
I also converted the project to a maven project but that did not help either.
我还将该项目转换为 maven 项目,但这也无济于事。
Any ideas? I am using Eclipse JUNO.
有任何想法吗?我正在使用 Eclipse JUNO。
采纳答案by user899757
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.
我想通了我的问题。我不得不从 CVS 中查看该项目。然后(这是重要的部分),在 eclipse 中执行一个现有项目的 maven 导入。这创建了 maven“就绪”项目,我可以在其中使用 IDE 的所有功能。
回答by AxeEffect
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.
你是对的。如果您直接从存储库导入,则悬停、链接和打开声明将不起作用。您的解决方案是正确的,尽管另一个更直接的方法是使用“File->New->Other->Maven->Checkout Maven Projects from SCM”。如果那时您有问题,因为您无法选择任何 SCM 类型,请检查Checkout Maven project from SCM - no connector。如果安装了连接器,您仍然有问题:http: //forum.springsource.org/showthread.php?102665-SCM-types-not-available-in-Checkout-Maven-Projects-from-SCM。
回答by TechGuy
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.
如果您已从 svn 签出项目,则签出的项目通常不是 eclipse 项目,这就是为什么 eclipse 的一般功能不适用于相同的原因。
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.
为了实现与 eclipse 相同的功能,如 eclipse reader 和所有其他快捷方式,我们必须将检出的项目转换为 eclipse 项目。
Steps to Convert checked out project to eclipse project:
将签出项目转换为 eclipse 项目的步骤:
- Right Click on Checked-out Project.
- Point to Configure.
- Click on Convert to Maven Project.(if checked out project is maven project)
- 右键单击已签出的项目。
- 指向配置。
- 点击Convert to Maven Project。(如果检出的项目是maven项目)
These steps will convert the project to Maven project.
这些步骤会将项目转换为 Maven 项目。
All the eclipse functionality will work for the same.
所有 eclipse 功能都将适用。
回答by kshitij
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.
除了确保项目配置为Maven项目外,您还可以进入项目属性(在包资源管理器中右键单击项目)>项目引用,在所选项目可能引用的工作区中添加项目。
回答by 18446744073709551615
I had this problem, too. It looks like after a search-in-workspace Eclipse opened a wrong file.
我也有这个问题。看起来像在工作区中搜索 Eclipse 打开了错误的文件之后。
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.
我按下 Strl+Shift+H(在层次结构中打开类型),输入类名,然后打开它。该文件在新选项卡中打开,一切都可以再次导航。
The difference in icons is:
图标的区别是: