这里是我的生成jar包Ant脚本。 我有一堆jar包的清单Class-Path属性的,他们都在一个特定的文件夹。
我不想硬编码,我怎么能自动获取它们呢?
<jar jarfile="${client_deploy_dir}/HelloWorld.jar"
basedir="${client_work_dir}/compiled">
<manifest>
<attribute name="Main-Class" value="HelloWorld.Main"/>
<attribute name="Class-Path" value="???"/>
</manifest>
</jar>
谢谢
你在正确的轨道上,使用manifestclasspath任务。 jar文件属性被用于创建包含在文件集的罐子相对链接。
<manifestclasspath property="jar.classpath" jarfile="${client_work_dir}/HelloWorld.jar">
<classpath>
<fileset name="" dir="${client_work_dir}/lib" includes="*.jar"/>
</classpath>
</manifestclasspath>
<jar jarfile="${client_deploy_dir}/HelloWorld.jar" basedir="${client_work_dir}/compiled">
<manifest>
<attribute name="Main-Class" value="HelloWorld.Main"/>
<attribute name="Class-Path" value=""${jar.classpath}"/>
</manifest>
</jar>
退房的蚂蚁pathconvert任务。 你可以使用这个扩展现有的文件集中到文件列表。