Eclipse缺少已导入的必需项目

时间:2023-01-17 18:01:37

I have 3 java projects in eclipse (A, B, C), where C is a required project for both A and B. Each time I start eclipse, I get the error

我在eclipse(A,B,C)中有3个java项目,其中C是A和B的必需项目。每次我启动eclipse时,我都会收到错误

 Project 'A' is missing required Java project: 'C'
 Project 'B' is missing required Java project: 'C'

When I remove project C from the build path of A or B, and add it again, the error disappears. The errors ... cannot be resolved to a type only appear when I remove project C from the build path, and F3-ing to source files in project C from project A or B works, implying that it does find the correct source files.

当我从A或B的构建路径中删除项目C并再次添加时,错误消失。只有当我从构建路径中删除项目C时才会出现错误...无法解析为类型,并且从项目A或B中F3到项目C中的源文件工作,这意味着它确实找到了正确的源文件。

My .classpath file looks like this:

我的.classpath文件如下所示:

<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JCIFS"/>
    <classpathentry combineaccessrules="false" kind="src" path="/C"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

My eclipse version is Galileo, plug-ins: Subclipse, CDT (so no Maven). Build automatically is checked.

我的eclipse版本是Galileo,插件:Subclipse,CDT(所以没有Maven)。检查自动构建。

Anybody know how I can avoid re-adding the project every time I start eclipse?

有人知道我每次开始日食时都能避免重新添加项目吗?

6 个解决方案

#1


7  

Try this:

  • Right click on your project name (A or B) and select properties...
  • 右键单击项目名称(A或B)并选择属性...

  • Select Java Build Path and the Projects tab, check project C as a required project on each of A and B.
  • 选择Java Build Path和Projects选项卡,将项目C检查为A和B中的每个项目。

  • Select the "Project References" option and check project C as a project reference on each of A and B.
  • 选择“项目引用”选项并将项目C作为项目引用检查A和B中的每一个。

  • Clean and rebuild just for the craic!
  • 清洁和重建只是为了疯狂!

  • Make sure Project C is not closed when eclipse is restarted.
  • 重启eclipse时,确保项目C未关闭。

#2


2  

I've seen this too, and on several occasions though with no clear pattern. I believe it is a bug in Eclipse.

我也看过这个,虽然没有明确的模式,但有几次。我相信这是Eclipse中的一个错误。

Sometime closing & re-opening project A fixes it. Sometimes I have to delete & re-install Eclipse to fix it.

有时关闭并重新打开项目A修复它。有时我必须删除并重新安装Eclipse才能修复它。

#3


0  

Have you simply tried to clean your workspace and do a full build?

您是否只是尝试清理工作区并进行完整构建?

#4


0  

This error typically happens if the project is closed. But you would get the error as soon as you close C - that is, long before you restart Eclipse.

如果项目已关闭,通常会发生此错误。但是,一旦关闭C就会出现错误 - 也就是说,在重新启动Eclipse之前很久。

It's quite hard to say what could cause this. Mabye it's an old bug but I don't remember anything specifically in 3.5 / Galileo.

很难说是什么导致这种情况。 Mabye这是一个古老的虫子,但我不记得3.5 / Galileo中的任何具体内容。

Try these things:

试试这些:

  1. "Clean..." and select all projects. Does that help?
  2. “干净......”并选择所有项目。这有帮助吗?

  3. When you get the error, did Eclipse succeed or fail to build C?
  4. 当您收到错误时,Eclipse是否成功或无法构建C?

  5. Is that a Java or C/C++ project? Maybe it's a bug in CDT.
  6. 这是一个Java或C / C ++项目吗?也许这是CDT中的一个错误。

  7. Try with Eclipse 3.7. It's pretty compatible with 3.5 but many bugs were fixed. Maybe that fixes your issue, too. Export your prefs, unpack 3.7 somewhere (leave 3.5 alone), import prefs. If you want to be 100% sure, create a second workspace.
  8. 尝试使用Eclipse 3.7。它与3.5非常兼容,但修复了许多错误。也许这也解决了你的问题。导出你的prefs,在某处解压缩3.7(单独留下3.5),导入prefs。如果您想100%确定,请创建第二个工作区。

#5


0  

I just had this too, and I think it was because of a resource filter. I was trying to hide .class files from the open resource dialogue. To fix this problem, I removed my resource filter and cleaned the projects - now it seems to be behaving well.

我也有这个,我认为这是因为资源过滤器。我试图隐藏开放资源对话中的.class文件。为了解决这个问题,我删除了我的资源过滤器并清理了项目 - 现在它似乎表现良好。

#6


-1  

This looks like a windows path names problem. Why do yo name your projects A, B, C and dont give them proper names isntead?

这看起来像一个Windows路径名称问题。你为什么要命名你的项目A,B,C并且不给它们正确的名字?

<classpathentry combineaccessrules="false" kind="src" path="/C"/>

I would bet that /C is interpreted errornously as a drive letter, hence your problems.

我敢打赌/ C被错误地解释为驱动器号,因此你的问题。

#1


7  

Try this:

  • Right click on your project name (A or B) and select properties...
  • 右键单击项目名称(A或B)并选择属性...

  • Select Java Build Path and the Projects tab, check project C as a required project on each of A and B.
  • 选择Java Build Path和Projects选项卡,将项目C检查为A和B中的每个项目。

  • Select the "Project References" option and check project C as a project reference on each of A and B.
  • 选择“项目引用”选项并将项目C作为项目引用检查A和B中的每一个。

  • Clean and rebuild just for the craic!
  • 清洁和重建只是为了疯狂!

  • Make sure Project C is not closed when eclipse is restarted.
  • 重启eclipse时,确保项目C未关闭。

#2


2  

I've seen this too, and on several occasions though with no clear pattern. I believe it is a bug in Eclipse.

我也看过这个,虽然没有明确的模式,但有几次。我相信这是Eclipse中的一个错误。

Sometime closing & re-opening project A fixes it. Sometimes I have to delete & re-install Eclipse to fix it.

有时关闭并重新打开项目A修复它。有时我必须删除并重新安装Eclipse才能修复它。

#3


0  

Have you simply tried to clean your workspace and do a full build?

您是否只是尝试清理工作区并进行完整构建?

#4


0  

This error typically happens if the project is closed. But you would get the error as soon as you close C - that is, long before you restart Eclipse.

如果项目已关闭,通常会发生此错误。但是,一旦关闭C就会出现错误 - 也就是说,在重新启动Eclipse之前很久。

It's quite hard to say what could cause this. Mabye it's an old bug but I don't remember anything specifically in 3.5 / Galileo.

很难说是什么导致这种情况。 Mabye这是一个古老的虫子,但我不记得3.5 / Galileo中的任何具体内容。

Try these things:

试试这些:

  1. "Clean..." and select all projects. Does that help?
  2. “干净......”并选择所有项目。这有帮助吗?

  3. When you get the error, did Eclipse succeed or fail to build C?
  4. 当您收到错误时,Eclipse是否成功或无法构建C?

  5. Is that a Java or C/C++ project? Maybe it's a bug in CDT.
  6. 这是一个Java或C / C ++项目吗?也许这是CDT中的一个错误。

  7. Try with Eclipse 3.7. It's pretty compatible with 3.5 but many bugs were fixed. Maybe that fixes your issue, too. Export your prefs, unpack 3.7 somewhere (leave 3.5 alone), import prefs. If you want to be 100% sure, create a second workspace.
  8. 尝试使用Eclipse 3.7。它与3.5非常兼容,但修复了许多错误。也许这也解决了你的问题。导出你的prefs,在某处解压缩3.7(单独留下3.5),导入prefs。如果您想100%确定,请创建第二个工作区。

#5


0  

I just had this too, and I think it was because of a resource filter. I was trying to hide .class files from the open resource dialogue. To fix this problem, I removed my resource filter and cleaned the projects - now it seems to be behaving well.

我也有这个,我认为这是因为资源过滤器。我试图隐藏开放资源对话中的.class文件。为了解决这个问题,我删除了我的资源过滤器并清理了项目 - 现在它似乎表现良好。

#6


-1  

This looks like a windows path names problem. Why do yo name your projects A, B, C and dont give them proper names isntead?

这看起来像一个Windows路径名称问题。你为什么要命名你的项目A,B,C并且不给它们正确的名字?

<classpathentry combineaccessrules="false" kind="src" path="/C"/>

I would bet that /C is interpreted errornously as a drive letter, hence your problems.

我敢打赌/ C被错误地解释为驱动器号,因此你的问题。