My project has many dependencies that I’ve referenced from other projects. I am now writing the build.xml file and am currently writing the JAR task. I guess I’ll begin with the bold presumption that if I expect my JAR to behave correctly outside of Eclipse, I’ll need to include a copy of each referenced JAR dependency somehwere in the JAR file.
So I now need to add a fileset under the jar task to instruct Ant to include these dependencies in the JAR. The problem is, when I switch to Navigator View and try to find my dependencies in my project, I don’t find them! The only reference to them is in a .classpath file that references their absolutely URLs, which I assume is how Eclipse finds them.
So my question is, how do I instruct Ant to look for the dependencies in this .classpath file and include them in my JAR?
My fear is that I’ll have to first manually copy each JAR into a directory underneath my project root, and then simply reference that directory in my build. But there’a a lot of JARs, and that would mean a lot of tiem lost to copy-n-pastin’.
Please no suggestions for Ivy or Maven, I’m well aware that these are the best solutions for my situation but for reasons outside the scope of this question, they are just not feasible.
Thanks for any help.
Do you want your project to produce an executable jar or will it be part of a distributable package that gets extracted and run? If its not an executable jar that you need then you should create a jar that includes just the classes and resources from your project without any of the dependent jars. Then if you want to release your project as a distributable package you would probably create a zip and tar.gz that includes the dependencies.
There is no way that I know of to automatically synchronize filesets between Ant and the Eclipse .classpath file. Aside from writing your own tool, which I’ve seen done before. So the manual copying of jars may turn out to be the quickest solution.