从 Perforce Eclipse Plugin 将项目导入为 Java 项目
我正在尝试从 Eclipse 中的 Perforce 工作区导入一个项目。它正在导入它(将文件提取到 java 包层次结构中),但问题是它没有作为“Java 项目”导入。所以我无法编辑“构建路径”或者没有类路径之类的东西。
有什么想法吗?
I am trying import a project from Perforce workspace in Eclipse. It is importing it (fetching the files into java package hierarchy) but the problem is it is not importing as "Java project". so i can't edit the "Build path" or there is no classpath or something.
Any idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要确保将 Eclipse 元数据文件放入源代码控制系统中。所有以 .在项目根目录以及整个 .settings 目录中,需要与源一起签入。如果您不这样做,Eclipse 将丢失有关项目类型以及应如何配置的所有知识。
You need to make sure to put Eclipse metadata files into your source control system. All files starting with . in the project root along with entire .settings directory need to get checked in along with your source. If you don't do that, Eclipse will loose all knowledge of the type of projects that it is and how it supposed to be configured.
如果 Perforce 中的项目不包含常规 Eclipse java 项目的文件,您可以使用 Java Nature 创建另一个项目。将项目保留为空。
它将为您创建以下文件。
默认情况下,此空项目的源文件夹设置为“src”。
现在您必须将上面提到的前两个文件复制到 Perforce 工作区目录中。关闭并重新打开项目。
如果仍有问题,请检查文件 .project。它应该包含自然部分。
现在检查您的 .classpath 文件。由于您从空白项目复制它,因此它包含类似以下内容:
您需要删除此默认的默认“src”文件夹并添加源文件夹,当然,如果您不会在 Eclipse 中进行开发,则不需要所有这些。如果你做的一切都正确,并且还添加了 JUnit Nature,你将得到如下内容:
If your Project in Perforce do not contain files of regular Eclipse java projects you can create another project with Java Nature. Keep Project empty.
It will create for you following files.
With this empty project by default your source folder is set to "src".
Now you have to copy first two files mentioned above to your Perforce workspace directory. Close and reopen project.
If you still have issues please check file .project. It should contain Nature section.
Now Check your .classpath File. Since you copied it from blank project it contains something like:
You need to remove this default default "src" folder and add your source folders, of course if you wont do development in eclipse you do not need all this. If you did everything correctly, andded also JUnit Nature you wil get something as follows: