Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse not synchronized with file system changes made by ant's build.xml

Tags:

java

eclipse

ant

We have a pretty big project. We use ant for setting the environment. One of the things that happens during the ant script is that a jar is copied to the lib folder of a project. Then, we use ant tasks: eclipse.refreshLocal and eclipse.incrementalBuild so that the jar now copied will resolve compilation problems in the project that refer to it.

Unfortunately, the projects seem unsynchronized with the filesystem. Project > properties > build path shows that the jar is present (probably information that is refresh while looking at the propertiesw) but the incrementalBuild didn't do what we expected it to do.

Also, sometimes a project that depends on this jar and we refreshed and built it (through ant) has a single compilation error: "The project cannot be resolved until build path errors are resolved". In other times, the are many compilation errors indicating the project hasn't noticed the new jar.

When I build it through eclipse, it is ok.

I was worried that maybe there are circular dependencies between the projects, but it appears the are no such dependencies (Build properties: the circular dependencies option is set to "Error", and the are no errors of this form in the projects).

Anybody is fimiliar with the problem? What is the proper way to deal with this problem?

Thank you for your help.

like image 240
ComputeALot Avatar asked Dec 03 '10 10:12

ComputeALot


People also ask

Does Eclipse support Ant?

Clicking on the targets, build / clean / usage will run Ant with the target. Clicking "fax" will execute the default target - usage. The Ant Eclipse plugin also comes with a good editor for editing build.

What is build xml in Ant?

The build. xml file contains information that the wsgen Java Ant task uses to assemble Web services into Enterprise Application archive (*. ear) files.


1 Answers

If you right click on the build.xml and select Run as → Ant Build... you'll see a tab called Refresh. Just check the option Refresh resources upon completion.

(I use this myself when generating code in an ANT xslt target and it works like a charm.)

enter image description here

You may also want to check Refresh automatically under Window → Preferences → Workspace

like image 122
aioobe Avatar answered Nov 03 '22 02:11

aioobe