How to use Ant to download/unpack jars from a single list of jars?
How can I use Ant to download and unpack java jars while only specifying the lis开发者_JAVA百科t of jars once? The key here is having one list of jars and generating:
- a list of URLs to download with a get task
- a classpath/fileset of the same jars locally
I'd really only like to specify the list of jars once.
<property name="dependency.lib.dir" location="dependencies" />
<mkdir dir="${dependency.lib.dir}" />
<get dest="${dependency.lib.dir}">
<url url="http://server1/lib1.jar"/>
<url url="http://server2/lib2.jar"/>
</get>
<fileset id="dependency.libs" dir="${dependency.lib.dir}">
<include name="*.jar" />
</fileset>
<path id="project.debug.classpath">
<fileset refid="dependency.libs" />
</path>
You can add additional sub-elements to the <path>
if you have a local lib directory.
As far as I can tell, this is not possible with ant.
精彩评论