蚂蚁 - 如何在一个特定的文件夹中获取所有文件的名称 [英] Ant - how to get all files' name in a specific folder

查看:162
本文介绍了蚂蚁 - 如何在一个特定的文件夹中获取所有文件的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的生成jar包Ant脚本。我有一大堆的jar包Class-Path清单属性的,他们都是在一个特定的文件夹。

Here is my Ant script for generating jar package. I have bunch of jar packages for manifest Class-Path attribute, they are all in an specific folder.

我不想硬code,我怎样才能让他们自动?

I don't want to hard code it, how can I get them automatically?

<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文件属性用于创建包含在文件集罐子相对链接。

You're on the right track, use manifestclasspath task. The jarfile attribute is used to create relative links to the jars contained in the fileset.

<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>

这篇关于蚂蚁 - 如何在一个特定的文件夹中获取所有文件的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆