Antoine Claval
Antoine Claval

Reputation: 4944

Refresh an Eclipse project with Ant

We have some Ant script fosr building the different jars we use, in several Eclipse projects. There is some interdependency

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.

There is a way to avoid the manual refresh step?

Upvotes: 31

Views: 15838

Answers (5)

Ahmad Nadeem
Ahmad Nadeem

Reputation: 2144

it can be done by following Ant tasks provided by the Eclipse platform.

<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

Upvotes: 0

KevinS
KevinS

Reputation: 7873

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?

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.

Another option is for Project B to reference Project A directly instead of referencing its jar file.

I think I may have misunderstood the problem you are having but I hope this helps anyway.

Upvotes: 0

Shadwell
Shadwell

Reputation: 34784

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.

Upvotes: 6

Scott Stanchfield
Scott Stanchfield

Reputation: 30652

You may want to turn on "Refresh Automatically".

See Window->Preferences->General->Workspace->Refresh Automatically

and it'll monitor filesystem changes for you.

Upvotes: 16

Roman P
Roman P

Reputation: 451

Try this:

<eclipse.refreshLocal resource="project_name/folder_name" depth="infinite" />

There are option details at the Eclipse help system.

Important: you have to choose "Run in the same JRE as workspace" at the Ant run configuration.

Upvotes: 34

Related Questions