在不同目录下的不同蚂蚁脚本中运行特定目标 [英] running specific target in different ant scripts in different directories

查看:23
本文介绍了在不同目录下的不同蚂蚁脚本中运行特定目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有大量的应用程序.它们都有一个位于项目基本目录中的 build.xml 文件.我正在尝试创建一个 ant 脚本,该脚本将遍历并调用所有项目中每个 build.xml 文件上的特定目标.

We have a large amount of apps. They all have a build.xml file located in the projects base directory. I am trying to create an ant script that will go through and call a specific target on each of the build.xml files in all the projects.

问题如下:

  1. 有些项目位于比其他项目更深的目录中.
  2. 一次只需要构建部分项目.

我试图使用 subant + antfile 并在属性文件中定义文件路径的 CSV,但这不起作用.以下是我所拥有的以及我遇到的错误.

I was trying to use subant + antfile and defining a CSV of file paths in a properties file, but this did not work. Below is what i have and the error i am getting.

如果有更好的方法可以做到这一点,或者您知道我的问题是什么,请告诉我!谢谢!

If there is a better way to do this or you know what my problem is, please let me know! Thanks!

这是在属性文件中定义的属性.我希望运行脚本的人在此处添加与他们正在运行的脚本的当前位置相关的文件路径.

This is the property defined in a property file. I am wanting the person running the script to add the file paths in here that are relative to the current location of the script they are running.

projects.to.build=

<小时>

这是我试图在主构建脚本中使用的子任务.


This is the subant task i am trying to use in the main build script.

    <filelist
        id="projectNames"
        dir="${basedir}"
        files="${projects.to.build}"
    />

    <target name="debugAll" description="Builds all the projects listed in the projectNames.properties file.">
        <subant target="debug" antfile="${projects.to.build}">
        </subant>
    </target>

<小时>

这是当我在属性文件中定义了项目时尝试运行构建脚本时遇到的错误.我正在使用相对路径.例如:..\Apps\AnApp1\build.xml,..\Apps\AnApp2\build.xml,..\OtherApps\foo\AnotherApp1\build.xml


Here is the error i get when i try to run the build script when there are projects defined in the properties file. I am using the relative path. For example: ..\Apps\AnApp1\build.xml,..\Apps\AnApp2\build.xml,..\OtherApps\foo\AnotherApp1\build.xml

"No Build Path Specified" (at my subant task)

推荐答案

您指定了 antfile 属性,因此 ANT 需要一个 build.xml 文件.

You specified the antfile attribute, so ANT was expecting to a single build.xml file.

subant 文档描述了如何使用文件集作为子参数.

The subant documentation describes how you can use a fileset as child parameter.

这是一个例子:

<project name="Subant demo" default="run-debug-target">
    <target name="run-debug-target">
        <subant target="debug">
            <fileset dir="." includes="**/build.xml" excludes="build.xml"/>
        </subant>
    </target>
</project>

<小时>

更新

或者可以使用文件列表:

<project name="Dry run" default="run">
    <target name="run">
        <subant target="test">
            <filelist dir="projects" files="one/build.xml,two/build.xml,three/build.xml,four/build.xml"/>
        </subant>
    </target>
</project>

处理以下构建文件:

  • projects/one/build.xml
  • projects/two/build.xml
  • projects/three/build.xml
  • projects/four/build.xml

这篇关于在不同目录下的不同蚂蚁脚本中运行特定目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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