Dashboard > OpenSource Project > ... > Ant > 8.調用其它buildfile
OpenSource Project Log In   View a printable version of the current page.
8.調用其它buildfile
Added by zach14c, last edited by zach14c on Sep 06, 2006  (view change)
Labels: 
(None)

您可以在一個buildfile中調用另一個buildfile,一個簡單的例子如下:

<project name="someproject" default="all">
    ......
    <target name="sometarget" depends="othertarget">
        <ant antfile="./project2/build.xml">
            <property name="condition_name" value="true">
        </ant>
    <target>
    ......
</project>

在<property>中設定value為true,當您在另一個buildfile中有目標使用了條件式(if或unless)時,這可以給予該條件一個true的特性值。

您也可以指定專案的目錄來調用預設的build.xml,例如:

<project name="someproject" default="all">
    ....
    <target name="sometarget" depends="othertarget">
        <ant dir="./project2">
            <property name="condition_name" value="true">
        </ant>
    <target>
    ....
</project>

您也可以僅僅調用另一個build中的某個目標,例如:

<ant antfile="./project2/build.xml" target="prepare"/>

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.1.5a Build:#411 Mar 16, 2006) - Bug/feature request - Contact Administrators