我如何知道在Ant中正确使用propertyselector任务? [关闭]

问题描述 投票:0回答:1

我试图了解来自antcontrib库的propertyselector任务正在使用的数据集的方式和位置。您能解释一下xml脚本的以下部分如何工作吗?

<!-- Import of Optional Tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
    <classpath>
        <pathelement location="${jcdk.home}/lib/ant-contrib-1.0b3.jar"/>
    </classpath>
</taskdef>

<!-- Package Settings -->
<property file="build.properties"/>

<target name="-packages.buildlist">
    <echo message="Building Package List..."/>

    <!-- Add all packages defined in setting into "packages.list.temp.unsorted" -->
    <propertyselector property="packages.list.temp.unsorted"
                      delimiter=","
                      match="PKG\.([^\.]*)\.NAME"
                      select="\1"
                      casesensitive="false"/>

    <!-- Create intermediate variables -->
    <var name="packages.list.temp.unsorted.refactored" value=""/>

    <!-- For each package in the list -->
    <for list="${packages.list.temp.unsorted}" param="pkg.id">
        <sequential>
            <var name="pkg.build.order" unset="true"/>
            <var name="pkg.name"        unset="true"/>

            <!-- Copy package information -->
            <propertycopy property="pkg.build.order" from="PKG.@{pkg.id}.BUILDNR"/>
            <propertycopy property="pkg.name"        from="PKG.@{pkg.id}.NAME"/>

            <if>
                <!-- Add the package and build order in "packages.list.temp.unsorted.refactored" -->
                <equals arg1="${packages.list.temp.unsorted.refactored}" arg2=""/>
                <then>
                    <var name="packages.list.temp.unsorted.refactored"
                         value="${pkg.build.order}.@{pkg.id}"/>
                </then>
                <else>
                    <var name="packages.list.temp.unsorted.refactored"
                         value="${packages.list.temp.unsorted.refactored},${pkg.build.order}.@{pkg.id}"/>
                </else>
            </if>
        </sequential>
    </for>

    <!-- Sort the list by build number -->
    <sortlist property="packages.list.temp.sorted"
              value="${packages.list.temp.unsorted.refactored}"
              delimiter="," />

    <!-- Remove the build number from the package name in the list -->
    <propertyregex property="packages.list"
                   input="${packages.list.temp.sorted}"
                   regexp="([0-9]+)\.([^\.^,]*,?)"
                   replace="\2"
                   casesensitive="false"/>

    <echo message="Package List: ${packages.list}"/>
    <echo message="Done..."/>
</target>

前言:Apache Ant是有效的黑洞,有用的文档在哪里?在哪里可以找到关于Apache Ant的有用信息,这些信息不会使我陷入困境?我一直在寻找事物的定义位置以及如何使用它们,但是我在Apache网站上找到的信息并非旨在向您展示如何使用功能(任务,目标等)。例如...我正在尝试使用propertyselector任务,但是定义上没有任何明确的文档。什么是财产?在哪里定义?分隔符在哪里定义?匹配在哪里定义?等等我花了很多时间试图弄清楚这些事情。真实的文档不再有价值吗?

java xml ant documentation
1个回答
0
投票

https://ant.apache.org/manual-1.9.x/index.html-基本手册https://www.tutorialspoint.com/ant/index.htm-如何使用任务等,更像是实用教程(entry lvl)

© www.soinside.com 2019 - 2024. All rights reserved.