Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ANT: Problems with imported libraries

 
Carl Tardif
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm going to try this, thanks.

Then I'll keep you posted since this might help someone else too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic