I have a ANT script and I have a lot of duplicated path to same set JAR files. But there is so many double wording in the classpath and also in the war element.
Since Ant 1.8.0 there is a new resource collection - mappedresources that
can be used in place of the war
task lib
element.
So, the task might look like this (pretty much straight from the docs):
This feature was added to resolve a long-standing feature request to make
the task flatten jars when deploying to WEB-INF/lib
.
previous answer:
Although you can't easily convert a path to a fileset with vanilla Ant, you can go the other way. So one option would be to define your jars in a fileset, and derive the path from it. Something like this perhaps:
Another possibility is to use the ant-contrib pathtofileset task.