Invoking dependency on parent object build.xml includes xml

Is it possible that the xml files included in the 'includes' inside build.xml depend on the goals from this build.xml (inverse relationship)? Or do I need to create a chain of only advanced dependencies and "depends" on the included File.target down? If possible, how can I name these parental goals?

I am trying to extract several targets from a very long build.xml file in this situation:

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

someTasks.xml define goals groupOfTasks, task0, task1, task2. groupOfTasks depends on task0, task1 and task2. Now does task0 task1 or task2 depend on buildMe on build.xml or some other goal defined in build.xml?

+1
source share
1 answer

This works for me: in the main project file, the default target value depends on the target from commontasks.xml, which depends on the 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 construct, I get:

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

The dependency of target defaultdepends on hellodepends on initMain, and hellocan use the properties defined in initMain.

+2
source

All Articles