如何将缺少.project .settings .classpath文件的java项目导入到eclipse中 [英] How to import a java project missing .project .settings .classpath files into eclipse
问题描述
我从opensource项目获得了一个java源代码。源代码没有eclipse项目特定文件,如.project,.classpath,.setting(目录)。如何将该java源导入eclipse?
I got a java source code from an opensource project. The source code doesn't have eclipse project specific files such as .project ,.classpath ,.setting(directory). How can I import that java source into eclipse ?
我没有指定pom.xml(mvn)文件。所以我尝试了手动。
I don't have pom.xml(mvn) file to specify. So I tried manually.
按照以下步骤解决
- 创建一个具有projectName的目录和projectName下的目录src。
- 将源代码(即:org / apache / hadoop目录)移动到projectName下的src目录中。
- 在eclipse中创建一个示例项目并转到工作区并通过更改项目名称来修改.project xml文件,.settings,.classpath文件
- 复制修改后的。项目文件和.settings,。classpath从eclipse工作区项目目录到新创建的目录projectName /
5.使用文件菜单下的eclipse导入选项导入新创建的项目使用现有项目到工作区选项 - 将项目根目录作为projectName目录。
- Create a directory with the projectName and a directory "src" under projectName.
- Move the source code ( ie: org/apache/hadoop directory) into src directory under projectName.
- Create a sample project in eclipse and go the workspace and modify the .project xml file by changing the project name ,.settings ,.classpath files
- Copy the modified ".project" file and ".settings" ,".classpath" from eclipse workspace project directory to the newly created directory "projectName/" 5 .Use eclipse import option under File menu to import the newly created project use Existing project into workspace option
- Give the project root directory as projectName directory.
推荐答案
如果你在项目文件夹中使用maven类型 mvn eclipse:eclipse
if you are using maven type mvn eclipse:eclipse
on project folder
如果你不是使用设g maven,转到eclipse,import-> import - > general - > filesystem(然后用源文件选择你的目录)
if you are not using maven, go to eclipse, import->import -> general -> filesystem (then select your directory with source files)
这篇关于如何将缺少.project .settings .classpath文件的java项目导入到eclipse中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!