Ant构建脚本,antcall,依赖关系等 [英] Ant build scripts, antcall, dependencies, etc

查看:183
本文介绍了Ant构建脚本,antcall,依赖关系等的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生成脚本,并作为脚本的一部分,将JAR文件复制到一个目录,为便于让称之为utils的罐子。在utils的罐是由另一构建脚本坐在另一个目录建造。什么我尝试做有我的构建脚本运行utils的构建脚本,这样我可以保证utils的罐子是最新的。

I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to date.

所以我知道我需要进口utils的构建文件。

So I know I need to import the utils build file.

<import file="../utils/build/build.xml" />

不工作,因为导入任务,与几乎所有其他蚂蚁TAKS,不从的basedir运行,它从PWD运行。因此,要解决,我有这个小玩意,这并成功导入构建文件

Which doesn't work because the import task, unlike almost every other ant taks, doesn't run from basedir, it runs from the pwd. So to get around that I have this little ditty, which does successfully import the build file

  <property name="baseDirUpOne" location=".." />
  <import file="${baseDirUpOne}/utils/build/build.xml" />

所以,现在,香港专业教育学院解决了我的问题,进口我需要调用任务,清楚,应该是很容易正确的:

So now that ive solved my import problem I need to call the task, well that should be easy right:

<antcall target="utils.package" />

注意,在上面,utils的是../ utils的项目名称/建设/ build.xml文件

我现在遇到了问题是蚂蚁的呼叫不../utils/build执行所以我需要什么,并不能找到,是一个RUNAT属性或类似的东西,基本上是:

the problem I'm now running into is that ant call doesn't execute in ../utils/build so what I need, and cant find, is a runat property or something similar, essentially:

<antcall target="utils.package" runat="../utils/build" />

我之所以需要这个是在我的utils的构建文件的步骤来选择code复制到罐子基于相对路径,以避免在我的蚂蚁硬编码文件路径。有任何想法吗?

The reason I need this is that in my utils build file the step to select which code to copy to the jar is based on relative paths so as to avoid hardcoding paths in my ant file. Any ideas?

推荐答案

我有类似的东西设立:我有一个主要的Ant build.xml它调用一个单独的build.xml这需要建立我的测试中照顾。这就是我如何做到这一点:

I've got something similar set up: I have a main Ant build.xml which calls a separate build.xml that takes care of building my tests. This is how I do it:

<target name="build-tests">
    <subant target="build">
      <fileset dir="${test.home}" includes="build.xml"/>
    </subant>
</target>

诀窍是使用 subant 而不是 antcall 。您没有导入其他构建文件。

The trick is to use subant instead of antcall. You don't have to import the other build file.

这篇关于Ant构建脚本,antcall,依赖关系等的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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