从父build.xml调用依赖目标,其中包括xml [英] Calling depends targets from parent build.xml inside includes xml

查看:93
本文介绍了从父build.xml调用依赖目标,其中包括xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

build.xml内的"includes"部分的xml文件是否可能依赖于该build.xml的目标(向后依赖)?还是我只需要创建一个仅包含前向依赖项的链,并且将includeFile.target降为依赖项"?如果可以的话,我该如何称呼这些父目标?

Is it possible for xml files that are part of 'includes' inside build.xml to have depends on targets from that build.xml (backwards dependency)? Or do I need to create a chain of only forward dependencies, and having "depends" on includedFile.target down? If this is possible, how do I call these parent targets?

在这种情况下,我试图从很长的build.xml文件中提取多个目标:

I am trying to extract several targets outside of a very long build.xml file, in a situation like this:

build.xml定义了一个非常普遍的目标,在整个build.xml文件中使用的buildMe.它还定义了一个目标runTasks.它包含someTasks.xml. runTasks取决于buildMe和someTasks.groupOfTasks.

build.xml defines a very common target, buildMe used throughout the build.xml file. It also defines a target runTasks. It includes someTasks.xml. runTasks depends on buildMe and someTasks.groupOfTasks.

someTasks.xml定义目标groupOfTasks,task0,task1,task2. groupOfTasks取决于task0,task1和task2.现在task0 task1或task2可以依赖build.xml中的buildMe或build.xml中定义的其他目标吗?

someTasks.xml define targets groupOfTasks, task0, task1, task2. groupOfTasks depends on task0, task1 and task2. Now can task0 task1 or task2 depend on buildMe from build.xml, or some other target defined in build.xml?

推荐答案

这对我有用:在主项目文件中,目标默认值取决于commontasks.xml中的目标,而该目标取决于主项目文件中的目标:

This works for me: In the main project file the target default depends on a target from commontasks.xml which depends on a target from the main project file:

<project name="main" default="default">

  <import file="commontasks.xml" as="common" />

  <target name="default" depends="common.hello" description="the main project">
  </target>

  <target name="initMain">
    <echo>initializing main</echo>
    <property name="aValue" value="MAIN" />
  </target>

<project name="commontasks" >

  <target name="hello" depends="initMain">
    <echo>hello from common tasks</echo>
    <echo>aValue: ${aValue}</echo>
  </target>

运行蚂蚁构建时,我得到:

When I run the ant build, I get:

initMain:
 [echo] initializing main
common.hello:
 [echo] hello from common tasks
 [echo] aValue: MAIN
default:
BUILD SUCCESSFUL

依赖关系是目标default取决于hello取决于initMain,并且hello可以使用在initMain中定义的属性.

The dependency is target default depends on hello depends on initMain and hello can use properties defined in initMain.

这篇关于从父build.xml调用依赖目标,其中包括xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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