如何将本地 GIT/Maven 项目/文件夹导入 Eclipse?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14816644/
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
How to import a local GIT/Maven project/folder into eclipse?
提问by JohnPristine
So I did git clone to get a maven project from a remote git repository. Great! I have been working in the command line, doing git pull, commit, etc. Great! Now I want to import this project into eclipse and be able to use git inside eclipse through the installed egit. So I did a:
所以我做了 git clone 从远程 git 存储库中获取一个 maven 项目。伟大的!我一直在命令行工作,做 git pull、commit 等。太棒了!现在我想将这个项目导入到 eclipse 中,并且能够通过安装的 egit 在 eclipse 中使用 git。所以我做了一个:
mvn eclipse:eclipse -Dwtpversion=2.0
And after that I am able to import the project into eclipse through the regular:
之后,我可以通过常规将项目导入到 eclipse 中:
Import -> General -> Existing Projects into Workspace
But the GIT options do not appear under Team !!! :( :( :(
但是 GIT 选项没有出现在 Team 下!!!:( :( :(
How do I import this project and have the git options at the same time?
如何导入此项目并同时拥有 git 选项?
回答by Andrew Mao
First, what you want to do is import the project as a Maven project directly. Then you don't have to do all the random command line stuff, plus you have the Maven integration in Eclipse with your dependencies and pom.xml
kept up to date. (You need m2e installed for this.) Go to Import and select 'Existing Maven Projects':
首先,您要做的是将项目直接作为Maven项目导入。然后,您不必执行所有随机的命令行操作,此外您还可以在 Eclipse 中将 Maven 集成与您的依赖项并pom.xml
保持最新状态。(为此您需要安装 m2e。)转到导入并选择“现有 Maven 项目”:
Then, what you should do is enable eGit on the project. Right click the root of the project and select "Share Project" under "Teams".
然后,您应该做的是在项目上启用 eGit。右键单击项目的根目录,然后在“团队”下选择“共享项目”。
Select Git and it will tell you that you can use the existing repo. Voila, you're done.
选择 Git,它会告诉你可以使用现有的 repo。瞧,你完成了。
回答by djechlin
Team > Share Project -> select the git project.
Team > Share Project -> 选择 git 项目。