在不同的目录不同的Ant脚本运行的特定目标 [英] running specific target in different ant scripts in different directories
问题描述
我们有大量的应用程序。它们都位于项目基地目录的build.xml
文件。我想创建一个Ant脚本将通过在所有项目调用特定的目标在每个的build.xml
文件。
下面是问题:
- 有些项目是比别人更深的目录。
- 只有部分项目需要一次待建。
我试图用 subant
+ antfile
,并在属性定义的文件路径CSV文件,但这没有奏效。下面是我和错误我收到。
如果有更好的办法做到这一点,或者你知道我的问题是什么,请让我知道!谢谢!
这是在属性文件中定义的属性。我想的人运行脚本来添加在这里是相对于它们所运行的脚本的当前位置的文件路径。
projects.to.build =
这是subant任务我试图在主构建脚本来使用。
<文件清单
ID =projectNames
DIR =$ {} BASEDIR
文件=$ {} projects.to.build
/> <目标名称=debugAll描述=构建在projectNames.properties文件中列出的所有项目。>
< subant目标=调试antfile =$ {} projects.to.build>
< / subant>
< /目标与GT;
以下是错误我得到当我试图运行时,有属性文件中定义的项目构建脚本。我使用的是相对路径。例如:.. \\ APPS \\ AnApp1 \\ build.xml文件,.. \\ APPS \\ AnApp2 \\ build.xml文件,.. \\ OtherApps \\富\\ AnotherApp1 \\ build.xml文件
没有指定构建路径(在我subant任务)
您指定的 antfile 属性,因此ANT期待一个单一的的build.xml 文件。
借助 subant文档介绍了如何使用一个文件集作为孩子的参数。
下面是一个例子:
<项目名称=Subant演示默认为运行调试目标>
<目标名称=运行调试目标>
< subant目标=调试>
<文件集DIR =。包括=** / build.xml文件不包括=build.xml文件/>
< / subant>
< /目标与GT;
< /项目>
更新
另外一个文件清单可以使用:
<项目名称=试运行默认为运行>
<目标名称=运行>
< subant目标=测试>
<文件列表DIR =项目文件=一/ build.xml文件,二/ build.xml文件,三/ build.xml文件,四/ build.xml文件/>
< / subant>
< /目标与GT;
< /项目>
处理以下构建文件:
- 项目/一个/ build.xml文件
- 项目/二/ build.xml文件
- 项目/三相/ build.xml文件
- 项目/四/ 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.
Here are the issues:
- Some of the projects are in deeper directories than others.
- Only some of the projects need to be built at a time.
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>
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)
You specified the antfile attribute, so ANT was expecting to a single build.xml file.
The subant documentation describes how you can use a fileset as child parameter.
Here's an example:
<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>
Update
Alternatively a filelist could be used:
<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>
Processing the following build files:
- projects/one/build.xml
- projects/two/build.xml
- projects/three/build.xml
- projects/four/build.xml
这篇关于在不同的目录不同的Ant脚本运行的特定目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!