File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Ant, Maven and Other Build Tools and the fly likes ANT: Problems with imported libraries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "ANT: Problems with imported libraries" Watch "ANT: Problems with imported libraries" New topic

ANT: Problems with imported libraries

Carl Tardif

Joined: Jul 04, 2006
Posts: 8
I hope someone can help me on this, been searching for a solution for a while now, to no avail.

I'm developping a project using Ant, Java and Eclipse (along with xml). I use a target called "all" which, like the name implies, calls all targets needed to build the project. Mainly, the "all" target imports libraries (.jar) that we need on compile time, build time and runtime. Then it deploys needed files, compiles java files, generates some files, packages and then distributes all needed files in a build file (.zip).

My problem is that this is all done in one sequence ... so after the import I need imported libraries to be taken into account because they are needed at compile time and later. Currently, I have "build path" errors in Eclipse, telling me needed libraries can't be found in the project (even if I just imported them).

To solve this problem, I thought doing a refresh of the Eclipse project after the import, using these functions would solve the problem:

Apparently, it does not solve the problem. So my question is, would anyone have a solution for this ? Currently, the first time I call it, the "all" target fails because it does not compile ... but the second time I call the "all" target the libraries are taken into account and the build path errors are solved but that is far from being ideal, since the "all" target takes a long time. I would like to be able to make sure Eclipse sees the newly imported libraries right after they are imported.

If you need precisions feel free to ask, I will check for replies everyday from now

Thanks in advance.
Carl Tardif

Joined: Jul 04, 2006
Posts: 8
No one can help ?

s it because I'm not giving enough precisions or because nobody has any ideas of how to solve this ?
Matt Harrah
Ranch Hand

Joined: Aug 05, 2006
Posts: 54
Well, I started fiddling with this to try and help since you weren't getting any help.

Does it make any difference if you use CLEAN_BUILD rather than INCREMENTAL_BUILD?

You may also want to try (as a test) putting a delay between the refresh and the build. I don't know for sure whether the refresh task blocks while it's doing its thing, so you may need a time delay to let it finish before you start the build.

Just a couple ideas to try.
Carl Tardif

Joined: Jul 04, 2006
Posts: 8
I'm going to try this, thanks.

Then I'll keep you posted since this might help someone else too.
I agree. Here's the link:
subject: ANT: Problems with imported libraries
jQuery in Action, 3rd edition