将项目导入Eclipse [英] Importing projects into Eclipse
问题描述
我有这个简单的问题,如何将整个项目源导入Ecplise,以便我可以很容易地浏览?具体来说,我已经下载了Maven源代码 http://maven.apache.org/download.html 而且我只想在Eclipse中查看它与其他项目一样。
我试图使用两个可能的选项(作为存档和项目)导入它,没有运气。
提前谢谢! Maven本身是一个Mavenized的多模块项目,通常有两种方式可以将Mavenized项目导入到像Eclipse这样的IDE中:
预先申请:
- 假设你有正确安装了Maven 3和设置环境变量
。 - 如果您使用Eclipse,您还需要向您添加M2_REPO
构建路径 - 类路径变量,请查看这里如何
设置。这告诉Eclipse在哪里找到存储在
本地maven库中的jar依赖项。
选项1 - 导入为Java项目:
-
打开命令提示符并转到提取的源文件夹,运行mvn eclipse:eclipse
并等待它完成,确保它没有弹出任何消息从[错误]开始,这个
将下载所有必需的jar依赖从互联网到你
本地maven仓库和创建.project和.classpath for Eclipse
在进行导入时使用。 -
在eclipse中,转到文件 - 导入 - 常规 - 现有项目
工作区,选择提取的源文件夹作为根目录。这个
将会将一组项目导入到Eclipse中,作为常规java
项目(即Package Explorer里面包含
资本J的项目图标)。
选项2 - 导入为Maven项目:
- 或者,如果您在Eclipse中安装了m2e插件,您可以
直接导入提取的项目文件夹,转到文件 - 导入 -
Maven - 现有的Maven项目,选择提取的源文件夹
作为根目录。这将导入一组项目到Eclipse
作为一堆Maven项目(项目图标在Package Explorer
水印与Capital M)。
希望这有帮助。
I have this simple question how to import whole project source into Ecplise so I can browse it easily? Specifically, I have downloaded Maven source code http://maven.apache.org/download.html and I just want to view it same as other projects in my Eclipse. I've tried to import it with use of two possible options (as archive and as a project) without luck.
Thank you in advance!
Maven itself is a Mavenized multi-module project, Generally there are two ways to import a Mavenized project into a IDE like eclipse:
Pre-requirment:
- Suppose you have installed Maven 3 and setup environment variable properly.
- if you use Eclipse, you also need add M2_REPO to you Build Path -- Classpath Variable, check out here for how to setup. this tells Eclipse where to find jar dependencies stored in local maven repository.
Option 1 -- Import as Java Project:
Open a command prompt and go to the extracted source folder, run mvn eclipse:eclipse and waiting for it finish, make sure it doesn't popup any message start with [ERROR], this will download all required jar dependencies from internet to you local maven repository and create .project and .classpath for Eclipse to use when doing import.
In eclipse, go to File -- Import -- General -- Existing Project into Workspace, select the extracted source folder as root directory. This will import a group of projects into Eclipse as bunch of regular java projects (i.e. project icon inside Package Explorer watermarked with a capital J).
Option 2 -- Import as Maven Project:
- Alternatively, if yo got m2e plugin installed in Eclipse, you can directly import the extracted project folder, go to File -- Import -- Maven -- Existing Maven Projects, select the extracted source folder as Root Directory. This will import a group of projects into Eclipse as bunch of Maven projects (project icon inside Package Explorer watermarked with a Capital M).
Hope this helps.
这篇关于将项目导入Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!