Eclipse“自动构建”不级联

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

Eclipse "Build Automatically" not cascading

javaeclipseeclipse-indigo

提问by mckamey

I have a project in Eclipse (Indigo but similar in Helios) which has files in src/main/resourceswhich get processed to generate *.java source files in target/generated-sources/xyz. The project settings have "Build Automatically" enabled so whenever these resource files are edited and saved the corresponding *.javafiles are generated. I've added target/generated-sources/xyzto the projects Build Paths. This all works perfectly.

我在 Eclipse 中有一个项目(Indigo,但在 Helios 中类似),其中包含经过src/main/resources处理以生成 .java 格式的 *.java 源文件的文件target/generated-sources/xyz。项目设置启用了“自动构建”,因此每当编辑和保存这些资源文件时,都会*.java生成相应的文件。我已经添加target/generated-sources/xyz到项目构建路径。这一切都完美无缺。

The problem is that the changes to the generated *.javafiles are inconsistently rebuilt. If I have one of those files open in the editor, then it notices that it changed and asks if I want to reload it. Reloading the *.javafiles is enough for it to recognize that it has changed and trigger a rebuild. If I don't have it open then it doesn't automatically pick up the changes.

问题是对生成的*.java文件的更改不一致地重建。如果我在编辑器中打开了其中一个文件,它会注意到它发生了变化并询问我是否要重新加载它。重新加载*.java文件足以让它识别出它已更改并触发重建。如果我没有打开它,那么它不会自动获取更改。

Any ideas on what I can do to let Eclipse (Indigo preferably) know that these generated files are being updated? Or better yet tell it to monitor those folders directly?

关于我可以做些什么让 Eclipse(最好是 Indigo)知道这些生成的文件正在更新的任何想法?或者更好的是告诉它直接监视这些文件夹?

Thanks.

谢谢。

回答by Matt Ball

Try configuring Eclipse to automatically refresh. I'm not sure about Indigo, but in Helios, it's in Preferences → General → Workspace → Refresh Automatically.

尝试将 Eclipse 配置为自动刷新。我不确定 Indigo,但在 Helios 中,它位于首选项 → 常规 → 工作区 → 自动刷新。



Here it is in Indigo:

这是靛蓝:

screenshot

截屏

回答by Tonny Madsen

I assume you have added an "Program"-based builder to the project that compiles/translates the files into .java.

我假设您已将一个基于“程序”的构建器添加到将文件编译/翻译为.java.

If you open the builder - via project properties -> Builders-> Edit...builder - then you can open the Refreshtab - se below.

如果您打开构建器 - 通过项目属性 -> Builders->Edit...构建器 - 那么您可以打开Refresh选项卡 - 如下所示。

Refresh tab of the Builder Dialog

构建器对话框的刷新选项卡

Here you can then select which resources to refresh when this particular build is run... E.g. all resources in target/generated-sources/xyz...

在这里你可以再选择时,这个特殊的构建在运行...例如,所有的资源,以刷新哪些资源target/generated-sources/xyz