为什么我的 eclipse 项目没有构建路径?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11234399/
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
Why does my eclipse project not have a build path?
提问by Niklas
What is the advantage with not having a build path in eclipse? Why is that setting default when it's like something you'd never use? It seems eclipse indigo was developed to make software development as obscure as possible. I just checked out a fresh copy of the project I checked in (called dungeonworld) this afternoon from another computer and automatically nothing works, can't compile, can't choose build path, can't add jre, can't add jdk, can't add that to project properties.
在 Eclipse 中没有构建路径有什么好处?为什么该设置是您从未使用过的默认设置?似乎 eclipse indigo 的开发目的是使软件开发尽可能地晦涩难懂。我刚刚从另一台计算机上检出了我今天下午检入的项目(称为 dungeonworld)的新副本,并且自动没有任何效果,无法编译,无法选择构建路径,无法添加 jre,无法添加 jdk , 无法将其添加到项目属性中。
Is my eclipse broken? I can't believe this is happening, such an easy thing not feasible.
我的日食坏了吗?我不敢相信这正在发生,这么简单的事情是不可行的。
回答by Amey Jadiye
回答by Konstantin Komissarchik
It looks like you did not add Eclipse project metadata files to your source control system, so Eclipse doesn't know what your build path is or whether it is even a java project. You can see that the little folder on your dungeonworld project is missing the little 'j', which means Eclipse doesn't think it's a java project.
看起来您没有将 Eclipse 项目元数据文件添加到您的源代码控制系统,因此 Eclipse 不知道您的构建路径是什么,甚至它是否是一个 java 项目。您可以看到 dungeonworld 项目上的小文件夹缺少小“j”,这意味着 Eclipse 不认为它是一个 java 项目。
Go back to your other computer and look for the following files in your original project root...
返回到您的另一台计算机并在您的原始项目根目录中查找以下文件...
- .project
- .classpath
- .settings/*
- 。项目
- .classpath
- .设置/*
Make sure all of the end up in your source control system or nothing will work right.
确保所有内容都在您的源代码控制系统中,否则将无法正常工作。
回答by Daniel kei
I have same problem, but i have solved
我有同样的问题,但我已经解决了
project right click -> properties -> java build path -> src/main/sources
项目右键->属性->java构建路径->src/main/sources
all remove items on "Excluded", and then that item turn the status "(None)"
所有删除“排除”上的项目,然后该项目将状态变为“(无)”
回答by THIMIRA
I tried below steps and it works for me.
我尝试了以下步骤,它对我有用。
Right click on project >> properties >> project facets >> click on java
右键单击项目>>属性>>项目方面>>点击java
回答by ptyx
Eclipse has a build path. It's stored in a (by default hidden) .classpath file in your project. You can also access it through the UI in project properties (right click on your project, properties, java build path).
Eclipse 有一个构建路径。它存储在项目中的(默认情况下隐藏的) .classpath 文件中。您还可以通过项目属性中的 UI 访问它(右键单击您的项目、属性、java 构建路径)。
回答by Babu
回答by nir
It's not a good practice to commit IDE related files into source control. What if someone in team uses different IDE? It might have been only option at a time when OP asked this question.
将 IDE 相关文件提交到源代码管理中并不是一个好习惯。如果团队中的某个人使用不同的 IDE 怎么办?在 OP 提出这个问题时,这可能是唯一的选择。
New versions on eclipse (4.x) takes care of this automatically. Probably by observing what kind of source and build files you have in your project.
eclipse (4.x) 上的新版本会自动处理这个问题。可能是通过观察您的项目中有什么样的源文件和构建文件。
回答by GF. Service
There where no entrys after right click on my projekt in Eclipse. How to click something, wenn build path entries are missing. So my Eclpise didn't detect my java project. I used following Maven command and after that I cleaned the project too. Now Projekt works as expected. So...
在 Eclipse 中右键单击我的项目后没有条目。如何单击某些内容,缺少构建路径条目。所以我的 Eclpise 没有检测到我的 java 项目。我使用了以下 Maven 命令,之后我也清理了项目。现在 Projekt 按预期工作。所以...
If you are using Maven, try mvn eclipse:eclipsein cmd console in your project directory! Make sure to use the path to your Maven folder for the command.
如果您使用的是 Maven,请在项目目录中的 cmd 控制台中尝试mvn eclipse:eclipse!确保为命令使用 Maven 文件夹的路径。
For example:
例如:
cd C:\yourEclipseProject\
C:\yourPathToMaven\apache-maven-2.2.1\bin\mvn eclipse:eclipse
This was helping me. After unsuccessful web research, a coworker told me this tip.
这对我有帮助。在网络研究失败后,一位同事告诉了我这个提示。