How do I set the Eclipse build path and class path from an Ant build file?

I've never found a really clean way to do it, but one "hackish" way to do it is to manipulate the . Classpath file eclipse uses (this contains the build path) So the . Classpath is going to have stuff in it like this: classpathentry kind="lib" path="C:/jboss-4.2.3.GA/client/jboss-system-client.

Jar So you could, for example, write some sort of batch script, etc. Which would read your ant file dependencies and put them into the eclipse . Classpath file (in the proper format, of course) But personally, I never fool with such things. What I do is just put all the jars my project needs in one folder, and then in my ant file I have a path set up like this: path id="all_libs"> The new jar you just dropped into the folder) This obviously doesn't work too well if you are sharing jars in a central place, but it works pretty well for smaller projects where you can just copy all the jars over to a centralized folder for the project.

I've never found a really clean way to do it, but one "hackish" way to do it is to manipulate the . Classpath file eclipse uses (this contains the build path). So the .

Classpath is going to have stuff in it like this: So you could, for example, write some sort of batch script, etc. Which would read your ant file dependencies and put them into the eclipse . Classpath file (in the proper format, of course). But personally, I never fool with such things.

What I do is just put all the jars my project needs in one folder, and then in my ant file I have a path set up like this: test_reflib just needs to be defined to wherever this folder is that contains all the jars. Then, on the eclipse side you can just do a "Add jars" and navigate to this same folder and just pick all the jars. What's even cooler is that any time you drop new jars into this folder, just click at the root level in the eclipse project and do "Refresh", and then edit the build path and click add jar again and it will only show you the jars that you haven't already added to the build path yet (i.e.

The new jar you just dropped into the folder). This obviously doesn't work too well if you are sharing jars in a central place, but it works pretty well for smaller projects where you can just copy all the jars over to a centralized folder for the project.

Thanks, this is helpful. I'm kind of hoping someone has already developed the sort of script you describe. In particular, these build files have lots of conditional includes, and I'd like to resolve them automatically.

– Nels Beckman Mar 16 '10 at 15:09.

From the raw ant distribution, first run "ant -f fetch. Xml" (or similar) to download a lot of needed dependencies. Add these to your Eclipse project and see if it helps.

This wasn't exactly the answer I was looking for, but it was quite helpful, thanks. – Nels Beckman Mar 16 '10 at 15:05.

I use the ivy to manage my ANT classpaths, I highly recommend learning how it works. There is an eclipse plugin that will manage the eclipse classpath from the same ivy. Xml file that ANT uses to define it's dependencies.

We've generated Ecipse . Classpath and . Project files from Ant for a large project with centrally located jars (100+) (not counting src jars and javadocs).

Similar to the build. Xml linked from here people.csail.mit.edu/stefie10/antAndEcli... with the obvious addition of the src and javadoc attributes.

Classpath file eclipse uses (this contains the build path). So you could, for example, write some sort of batch script, etc. which would read your ant file dependencies and put them into the eclipse . Classpath file (in the proper format, of course).

But personally, I never fool with such things. Test_reflib just needs to be defined to wherever this folder is that contains all the jars. Then, on the eclipse side you can just do a "Add jars" and navigate to this same folder and just pick all the jars.

What's even cooler is that any time you drop new jars into this folder, just click at the root level in the eclipse project and do "Refresh", and then edit the build path and click add jar again and it will only show you the jars that you haven't already added to the build path yet (i.e. The new jar you just dropped into the folder). This obviously doesn't work too well if you are sharing jars in a central place, but it works pretty well for smaller projects where you can just copy all the jars over to a centralized folder for the project.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions