简体   繁体   English

如何将缺少.project .settings .classpath文件的java项目导入到eclipse中

[英]How to import a java project missing .project .settings .classpath files into eclipse

I got a java source code from an opensource project. 我从opensource项目获得了一个java源代码。 The source code doesn't have eclipse project specific files such as .project ,.classpath ,.setting(directory). 源代码没有eclipse项目特定文件,如.project,.classpath,.setting(目录)。 How can I import that java source into eclipse ? 如何将该java源导入eclipse?


I don't have pom.xml(mvn) file to specify. 我没有要指定的pom.xml(mvn)文件。 So I tried manually. 所以我尝试了手动。

followed the below steps to solve 按照以下步骤解决

  1. Create a directory with the projectName and a directory "src" under projectName. 在projectName下创建一个带有projectName和目录“src”的目录。
  2. Move the source code ( ie: org/apache/hadoop directory) into src directory under projectName. 将源代码(即:org / apache / hadoop目录)移动到projectName下的src目录中。
  3. Create a sample project in eclipse and go the workspace and modify the .project xml file by changing the project name ,.settings ,.classpath files 在eclipse中创建一个示例项目并转到工作区并通过更改项目名称,.settings,.classpath文件来修改.project xml文件
  4. 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 将修改后的“.project”文件和“.settings”,“。classpath”从eclipse工作区项目目录复制到新创建的目录“projectName /”5。使用“文件”菜单下的“eclipse导入”选项导入新创建的项目使用“现有项目”进入工作区选项
  5. Give the project root directory as projectName directory. 将项目根目录作为projectName目录。

if you are using maven type mvn eclipse:eclipse on project folder 如果你使用maven类型mvn eclipse:eclipse项目文件夹上的mvn eclipse:eclipse

if you are not using maven, go to eclipse, import->import -> general -> filesystem (then select your directory with source files) 如果您不使用maven,请转到eclipse,import-> import - > general - > filesystem(然后选择包含源文件的目录)

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: 你可以按照以下步骤:

  1. copy your project or open source project into workspace. 将项目或开源项目复制到工作区。
  2. window ->File ->New -> Java Project ->Project name input that just be copied project file name ->Finish 窗口 - >文件 - >新建 - > Java项目 - >项目名称输入,只需复制项目文件名 - >完成

Remember config your source code location: 请记住配置您的源代码位置:

project ->Properties ->Java Build Path ->Source project - > Properties - > Java Build Path - > Source

If this is a maven project then you will not find these .project files. 如果这是一个maven项目,那么你将找不到这些.project文件。 So instead of using import -> Existing project to Workspace use Existing Maven Project. 因此,而不是使用导入 - >现有项目到Workspace使用现有Maven项目。

在此输入图像描述

在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM