Eclipse 告诉我在构建路径中检测到一个循环,但事实并非如此!

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3446314/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:58:36  来源:igfitidea点击:

Eclipse is telling me a cycle was detected in the building path, but that's not true!

apache-flexeclipse

提问by user220755

Eclipse is telling me:

Eclipse 告诉我:

a cycle was detected in the build path of -project name-

, although the structure of the project (created by others in the team) does not have cycles.
The same project is deployed on other machines (the same!) and it doesn't give the error.

,虽然项目的结构(由团队中的其他人创建)没有周期。
相同的项目部署在其他机器上(相同!)并且它没有给出错误。

I need to work from my machine so I need to solve this.
It is giving me the error in 8 different projects.
It was giving me the error in more (10 projects) but with cleaning and building 10 times just changed to 8! (without any changes in the code).

我需要在我的机器上工作,所以我需要解决这个问题。
它给了我 8 个不同项目的错误。
它给了我更多(10 个项目)的错误,但是清理和构建 10 次只是更改为 8 次!(代码中没有任何更改)。

I really need to get this working and cleaning and building over and over is not doing anything. Any tips?

我真的需要让这个工作和清洁和一遍又一遍地构建没有做任何事情。有小费吗?

(note: this is not java, this is flex so i can't change the error to warning :))

(注意:这不是 java,这是 flex 所以我不能将错误更改为警告 :))

Thanks a lot!

非常感谢!

采纳答案by VonC

If it works on other machines but not your own, it must be a "local cache" effect.

如果它适用于其他机器而不是您自己的机器,则必须是“本地缓存”效果。

You must have an existing library taken into account from a long time, which causes locally the error, while that same file is not present on the other workstations.

您必须长期考虑现有库,这会导致本地错误,而其他工作站上不存在相同的文件。

Could try and recreate the projects from scratch, on a new empty directory, and see if the problem persist?
If it does (and only then), the exact version of Eclipse and Flex plugin could help.

可以尝试在新的空目录上从头开始重新创建项目,看看问题是否仍然存在?
如果确实如此(并且仅如此),Eclipse 和 Flex 插件的确切版本可能会有所帮助。

回答by David Collie

Try creating a new workspace then import the projects into that.

尝试创建一个新工作区,然后将项目导入其中。

回答by Hans de Jong

The problem most often arises after migrating your code. You have always been working on one project at a time, and all the time one of the projects was in a compiled state, so the builder didn't complain. There is no law of nature that says that code shouldn't be mutually dependent (it happens within projects all the time), but many builders, also in Eclipse, have problems with this chicken-egg problem and start complaining if both project's are not compiled: “cycle detected in buildpath”. Often you'll get the advise to adjust the severity level of circular dependencies to give only warnings (in Eclipse: Window > Preferences > Java > Compiler > Building > Build path Problems > Circular dependencies), but that's no real solution. Make a component-diagram of your projects and their dependencies (I advise to use BOUML, freeware UML-editor, or Rational Rose), and imagine the builder working from right to left starting with nothing. If necessary, make a new project on the right and remove circularities between projects by moving definitions/interfaces that more projects should know of in there. (You could call this a leaf-project, needing nothing else, but the result is not necessarily a tree, it's a net that you can traverse right to left).

该问题最常出现在迁移代码之后。您总是一次只处理一个项目,并且其中一个项目一直处于编译状态,因此构建器没有抱怨。没有任何自然法则规定代码不应该相互依赖(它一直在项目中发生),但是许多构建者,也在 Eclipse 中,遇到了这个先有鸡还是先有蛋的问题,如果两个项目都不是,就会开始抱怨编译:“在构建路径中检测到循环”。通常,您会收到调整循环依赖项的严重性级别以仅给出警告的建议(在 Eclipse 中:窗口 > 首选项 > Java > 编译器 > 构建 > 构建路径问题 > 循环依赖项),但这不是真正的解决方案。制作您的项目及其依赖项的组件图(我建议使用 BOUML、免费软件 UML 编辑器或 Rational Rose),并想象构建器从右到左从无到有工作。如有必要,在右侧创建一个新项目并通过移动更多项目应该知道的定义/接口来消除项目之间的循环。(您可以将其称为叶项目,不需要其他任何东西,但结果不一定是一棵树,它是一个您可以从右到左遍历的网络)。

回答by Hans de Jong

Sorry for reposting. I saw that the text of my earlier answer was scrambled.

抱歉重新发布。我看到我之前回答的文字被打乱了。



该问题最常出现在迁移代码之后。您总是一次只处理一个项目,而其他项目一直处于编译状态,因此构建器没有抱怨。没有任何自然法则规定代码不应该相互依赖(它一直发生在项目中),但是许多构建者,也在 Eclipse 中,遇到了这个先有鸡还是先有蛋的问题,如果两个项目都不是,就会开始抱怨编译:“在构建路径中检测到循环”。通常,您会收到调整循环依赖项的严重性级别以仅给出警告的建议(在 Eclipse 中:窗口 > 首选项 > Java > 编译器 > 构建 > 构建路径问题 > 循环依赖项),但这不是真正的解决方案。





制作您的项目及其依赖项的组件图(我建议使用 BOUML、免费软件 UML 编辑器或 Rational Rose),并想象构建器从右到左从无到有工作。如有必要,在右侧创建一个新项目并通过移动更多项目应该知道的定义/接口来消除项目之间的循环。(您可以将其称为叶项目,不需要其他任何东西,但结果不一定是一棵树,它是一个您可以从右到左遍历的网络)。