eclipse 在eclipse中导入maven项目 - 文件夹结构不符合预期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13118512/
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
Import maven project in eclipse - folder structure not as expected
提问by mtk
I am new to maven projects. Steps followed :
我是 Maven 项目的新手。步骤如下:
- I tried importing a maven project in eclipse through
File
->Import
. - Gave the location of root dir of the svn checkout project. It recognized the
pom.xml
file. - Clicked
Finish
. Project imported and all files were placed in the Project Explorer of the eclipse.
- 我尝试通过
File
->在 Eclipse 中导入一个 Maven 项目Import
。 - 给出了 svn checkout 项目的根目录的位置。它识别了该
pom.xml
文件。 - 点击
Finish
。项目导入,所有文件都放在eclipse的Project Explorer中。
Problem:
问题:
The directory structure was not as that of a java package, it was just a normal folder structure. I am not able to browse the code quickly i.e. get the declaration, different calls to a method and all the code browsing shortcuts. It gives a error says.. Project not in Build Path. On right clicking the project, there are no options present in the 'Build Path'.
目录结构不像java包那样,它只是一个普通的文件夹结构。我无法快速浏览代码,即获取声明、对方法的不同调用以及所有代码浏览快捷方式。它给出了一个错误说.. 项目不在构建路径中。右键单击项目,“构建路径”中没有选项。
Please let me know, what I am doing wrong here. How to import a maven project correctly into eclipse and set it up ?
请让我知道,我在这里做错了什么。如何将 Maven 项目正确导入 Eclipse 并进行设置?
回答by ant
Run :
跑 :
mvn eclipse:clean
Then
然后
mvn eclipse:eclipse
And it should be it's old self again, if not refresh the project in eclipse and that should do it
它应该又是旧的自己,如果不在 Eclipse 中刷新项目并且应该这样做
回答by Vedprakash Panda
I have faced similar issue . I have resolved this issue :
我遇到过类似的问题。我已经解决了这个问题:
Right click on project -> properties -> Project Facets -> convert it into Facet form
右键单击项目-> 属性-> Project Facets -> 将其转换为Facet 形式
And you can get the folder structure as you want
您可以根据需要获取文件夹结构
回答by arunky
I faced the same issue and could resolve by following steps
我遇到了同样的问题,可以通过以下步骤解决
- First ensure that you are able to maven clean or install. Just to ensure the proj setup works.
- Right click on Project.
- Navigate to Maven> Update project configuration.
- 首先确保您能够进行 Maven 清理或安装。只是为了确保项目设置有效。
- 右键单击项目。
- 导航到Maven>更新项目配置。
This should resolve the issue. Hope this helps.
这应该可以解决问题。希望这可以帮助。
回答by swapnil thange
I resolved this issue with:
我解决了这个问题:
- go to Window > Preferences > build path
- under output and source folder choose the project
- delete/backup original project and create/import the same.
- 转到窗口 > 首选项 > 构建路径
- 在输出和源文件夹下选择项目
- 删除/备份原始项目并创建/导入相同的项目。
your issue will be resolved.
您的问题将得到解决。