如何将缺少 .project .settings .classpath 文件的 java 项目导入 eclipse
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14769451/
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 java project missing .project .settings .classpath files into eclipse
提问by SachinJ
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 ?
我从一个开源项目中得到了一个 java 源代码。源代码没有 Eclipse 项目特定的文件,例如 .project 、.classpath 、.setting(directory)。我怎样才能将该 java 源导入到 eclipse 中?
I don't have pom.xml(mvn) file to specify. So I tried manually.
我没有要指定的 pom.xml(mvn) 文件。所以我手动尝试。
followed the below steps to solve
按照以下步骤解决
- 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.
- 使用 projectName 创建一个目录,在 projectName 下创建一个目录“src”。
- 将源代码(即:org/apache/hadoop 目录)移动到projectName 下的src 目录中。
- 在eclipse中创建一个示例项目并进入工作区并通过更改项目名称、.settings、.classpath文件来修改.project xml文件
- 将修改后的“.project”文件和“.settings”、“.classpath”从eclipse工作区项目目录复制到新创建的目录“projectName/” 5.使用文件菜单下的eclipse导入选项导入新创建的项目使用现有项目进入工作区选项
- 将项目根目录指定为 projectName 目录。
回答by TheWhiteRabbit
if you are using maven type mvn eclipse:eclipse
on project folder
如果您mvn eclipse:eclipse
在项目文件夹上使用 maven 类型
if you are not using maven, go to eclipse, import->import -> general -> filesystem (then select your directory with source files)
如果您不使用 maven,请转到 eclipse,导入->导入-> 常规-> 文件系统(然后选择包含源文件的目录)
回答by Edward Wu
If you doesn't have .project .classpath and .settings file, Representing the project isn't eclipse project, so you should create a standard eclipse project
如果你没有 .project .classpath 和 .settings 文件,代表项目不是eclipse项目,所以你应该创建一个标准的eclipse项目
you can following below step:
您可以按照以下步骤操作:
- copy your project or open source project into workspace.
- window ->File ->New -> Java Project ->Project name input that just be copied project file name ->Finish
- 将您的项目或开源项目复制到工作区。
- window ->File ->New -> Java Project ->Project name 输入刚才复制的项目文件名 ->Finish
Remember config your source code location:
记住配置你的源代码位置:
project ->Properties ->Java Build Path ->Source
项目 -> 属性 -> Java 构建路径 -> 源代码