【问题标题】:Turning an ant propertyset into a fileset将 ant 属性集转换为文件集
【发布时间】:2011-02-03 19:50:55
【问题描述】:

我有一个属性集,其中属性集的值指定了我想要包含在 jar 中的文件列表。但我似乎无法弄清楚如何从属性集构建一个 jar,只有一个文件集。如何将属性集的值转换为 ant 文件集?

【问题讨论】:

    标签: ant fileset


    【解决方案1】:

    我做了一些工作并找到了一种可行的方法。我构建了一个以逗号分隔的属性值列表,然后将其作为 filesetinclude 属性传递。

    <target name="buildjarfromprops">
      <!-- read list of files to include from properties -->
      <property file="files.properties"/>
      <!-- select the properties to include -->
      <propertyset id="includeFiles">
        <propertyref prefix="files."/>
      </propertyset>
      <!-- build a comma-separated list of files to include -->
      <pathconvert refid="includeFiles" pathsep="," property="includeFiles"/>
      <!-- now jar them all up -->
      <property name="sourcedir" value="/dir"/>
      <jar destfile="destjar.jar" basedir="${sourcedir}" includes="${includeFiles}"/>
    </target>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-04-05
      • 1970-01-01
      • 2011-11-22
      • 2017-11-28
      • 2019-08-07
      • 1970-01-01
      相关资源
      最近更新 更多