简体   繁体   中英

How to redefine target in Ant?

file1.xml

<project name="main_file">
  <import file="file2.xml"/>
  ...
</project>

file2.xml

<project name="inc_file">
  <target name="target1">
    ... 
  </target>
</project>

Can I redefine inc_file.target1 in file1.xml ? Target in main_file should be called instead of inc_file.target1 .

UPD : I didn't want the old target was called. I would like to get a new target replaced the old

See Ant documentation for import task. It explains clearly that import behave like you expect (see subsection Target overriding ): just redefine your target1 target in main_file and it will override the one defined in inc_file .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM