Ant copy classpath jars to a directory
ant, classpath, copy, java
Solution
The Ant Manual on the copy task contains the answer for your problem. One of the example snippets it provides:
Collect all items from the current CLASSPATH setting into a destination directory, flattening the directory structure.
<copy todir="dest" flatten="true">
<path>
<pathelement path="${java.class.path}"/>
</path>
</copy>
Problem
I'm sure this has either been asked before or is pretty straightforward. But for whatever reason, I cannot seem to make it work. I want to use ant to copy the `${build.classpath}` (which contains a colon separated list of jars) to the `${output.dir}/myapp/WEB-INF/lib`. I have this right now and it doesn't seem to work: ``` <copy toDir="${output.dir}/myapp/WEB-INF/lib"> <fileset file="${build.classpath}" /> </copy> ``` It treats the whole classpath as one file. How do I get this to work?