We have some Ant script fosr building the different jars we use, in several Eclipse projects. There is some interdependency
在一些Eclipse项目中,我们有一些Ant脚本来构建我们使用的不同jar。有一些相互依赖
At the end of the build, we have to refresh some of the Eclipse projects in order to make the build path valid. Without this, it doesn't see one of the just-built jars and Eclipse throws a build path error.
在构建结束时,我们必须刷新一些Eclipse项目,以使构建路径有效。没有它,它没有看到一个刚刚构建的jar,Eclipse抛出了构建路径错误。
There is a way to avoid the manual refresh step?
有一种方法可以避免手动刷新步骤吗?
5 个解决方案
#1
Try this:
<eclipse.refreshLocal resource="project_name/folder_name" depth="infinite" />
There are option details at the Eclipse help system.
Eclipse帮助系统中有选项详细信息。
Important: you have to choose "Run in the same JRE as workspace" at the Ant run configuration.
要点:您必须在Ant运行配置中选择“在与工作空间相同的JRE中运行”。
#2
You may want to turn on "Refresh Automatically".
您可能想要启用“自动刷新”。
See Window->Preferences->General->Workspace->Refresh Automatically
请参见窗口 - >首选项 - >常规 - >工作区 - >自动刷新
and it'll monitor filesystem changes for you.
它会监视文件系统的变化。
#3
If you're running the ant script from within eclipse you can right-click on it and select "Run As >" then "Ant Build...". There's a 'Refresh' panel in the options to run the script which you can choose to refresh various things after the script completes.
如果你在eclipse中运行ant脚本,你可以右键单击它并选择“Run As>”然后选择“Ant Build ...”。运行脚本的选项中有一个“刷新”面板,您可以选择在脚本完成后刷新各种内容。
#4
This might not be answering your question exactly but I don't quite understand what is causing the problem.
这可能不是完全回答你的问题,但我不太明白导致问题的原因。
As I understand it you have a project A that creates a jar file and that jar file is referenced by project B. When you re-build project A, you need to refresh so that project B can see the new jar file. Is that correct?
据我所知,你有一个项目A创建一个jar文件,该jar文件由项目B引用。当你重新构建项目A时,你需要刷新,以便项目B可以看到新的jar文件。那是对的吗?
I do something similar but I don't get any build path errors because the name of the project A jar file hasn't changed.
我做了类似的事情,但我没有得到任何构建路径错误,因为项目的名称jar文件没有改变。
Another option is for Project B to reference Project A directly instead of referencing its jar file.
另一个选项是项目B直接引用项目A而不是引用其jar文件。
I think I may have misunderstood the problem you are having but I hope this helps anyway.
我想我可能误解了你所遇到的问题,但我希望无论如何这都会有所帮助。
#5
it can be done by following Ant tasks provided by the Eclipse platform.
它可以通过遵循Eclipse平台提供的Ant任务来完成。
<eclipse.refreshLocal resource="MyProject/MyFolder" depth="infinite"/>
Note: make sure to run Ant inside the same VM where Eclipse workspace is running, for details check following links
注意:确保在运行Eclipse工作区的同一VM中运行Ant,有关详细信息,请查看以下链接
- Problem: failed to create task or type eclipse.refreshLocal
- Ant tasks provided by the Eclipse platform
问题:无法创建任务或输入eclipse.refreshLocal
Eclipse平台提供的Ant任务
#1
Try this:
<eclipse.refreshLocal resource="project_name/folder_name" depth="infinite" />
There are option details at the Eclipse help system.
Eclipse帮助系统中有选项详细信息。
Important: you have to choose "Run in the same JRE as workspace" at the Ant run configuration.
要点:您必须在Ant运行配置中选择“在与工作空间相同的JRE中运行”。
#2
You may want to turn on "Refresh Automatically".
您可能想要启用“自动刷新”。
See Window->Preferences->General->Workspace->Refresh Automatically
请参见窗口 - >首选项 - >常规 - >工作区 - >自动刷新
and it'll monitor filesystem changes for you.
它会监视文件系统的变化。
#3
If you're running the ant script from within eclipse you can right-click on it and select "Run As >" then "Ant Build...". There's a 'Refresh' panel in the options to run the script which you can choose to refresh various things after the script completes.
如果你在eclipse中运行ant脚本,你可以右键单击它并选择“Run As>”然后选择“Ant Build ...”。运行脚本的选项中有一个“刷新”面板,您可以选择在脚本完成后刷新各种内容。
#4
This might not be answering your question exactly but I don't quite understand what is causing the problem.
这可能不是完全回答你的问题,但我不太明白导致问题的原因。
As I understand it you have a project A that creates a jar file and that jar file is referenced by project B. When you re-build project A, you need to refresh so that project B can see the new jar file. Is that correct?
据我所知,你有一个项目A创建一个jar文件,该jar文件由项目B引用。当你重新构建项目A时,你需要刷新,以便项目B可以看到新的jar文件。那是对的吗?
I do something similar but I don't get any build path errors because the name of the project A jar file hasn't changed.
我做了类似的事情,但我没有得到任何构建路径错误,因为项目的名称jar文件没有改变。
Another option is for Project B to reference Project A directly instead of referencing its jar file.
另一个选项是项目B直接引用项目A而不是引用其jar文件。
I think I may have misunderstood the problem you are having but I hope this helps anyway.
我想我可能误解了你所遇到的问题,但我希望无论如何这都会有所帮助。
#5
it can be done by following Ant tasks provided by the Eclipse platform.
它可以通过遵循Eclipse平台提供的Ant任务来完成。
<eclipse.refreshLocal resource="MyProject/MyFolder" depth="infinite"/>
Note: make sure to run Ant inside the same VM where Eclipse workspace is running, for details check following links
注意:确保在运行Eclipse工作区的同一VM中运行Ant,有关详细信息,请查看以下链接
- Problem: failed to create task or type eclipse.refreshLocal
- Ant tasks provided by the Eclipse platform
问题:无法创建任务或输入eclipse.refreshLocal
Eclipse平台提供的Ant任务