简体   繁体   English

为什么有时eclipse在导入工作区时不需要.project和.classpath文件/eclipse如何将项目识别为项目?

[英]Why sometimes eclipse doesn't need .project and .classpath file during importing into workspace/How does eclipse recognize projects as projects?

I just checked out some projects from svn to my pc, and I tried to import the projects into my workspace.我刚刚检查了一些从 svn 到我的电脑的项目,我尝试将这些项目导入我的工作区。 But I failed to import some of them, and eclipse didn't recognize those projects(didn't show up in the import window).但是我没有导入其中的一些,eclipse 没有识别这些项目(没有出现在导入窗口中)。 And then I turn to google and found a solution -"add.projects and.classpath file to project folder" works.然后我转向谷歌并找到了一个解决方案 - “将.projects和.classpath文件添加到项目文件夹”有效。 However, what make me really confusing is that I foundthe projects I successfully imported into workspace without manually adding the files for them also don't contain.projects and.classpath.然而,真正让我困惑的是,我发现我成功导入工作区的项目没有手动添加文件,也不包含.projects 和.classpath。 Eclipse just create the files for them automatically after import, so it seems that the fail of importing projects(or recognizing projects during import) is not just simply because of the lack of.projects and.classpath. Eclipse 只是在导入后自动为它们创建文件,因此似乎导入项目(或在导入过程中识别项目)失败不仅仅是因为缺少.projects和.classpath。 Does anyone know what cause the difference?有谁知道导致差异的原因是什么? How does eclipse exactly recognize a project as importable project? eclipse 如何准确地将项目识别为可导入项目? * eclipse version info here * eclipse 版本信息在这里

Eclipse or any other IDE doesn't required .classpath or .project files. Eclipse 或任何其他 IDE 不需要.classpath.project文件。 These files will be auto created during the project import.这些文件将在项目导入期间自动创建。 IDE can capable to pull the artifacts from maven central repo automatically by using build descriptor file such as pom.xml or build.graddle . IDE 可以通过使用构建描述符文件(例如pom.xmlbuild.graddle )自动从 maven 中央仓库中提取工件。

The files .classpath and .project will store the paths from local machine, if we carry them to another system, the artificats and other dependencies may not be present in the same directory, so it will start complaining build errors. .classpath.project文件将存储本地机器的路径,如果我们将它们带到另一个系统,artificats 和其他依赖项可能不在同一目录中,因此它会开始抱怨构建错误。 Thats why while committing to GIT always there is .gitignore , so that local configuration will not carry to others while contributing.这就是为什么在提交 GIT 时总是有.gitignore ,这样本地配置不会在贡献时传递给其他人。

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

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