內部邀請碼: C8E245J (不寫邀請碼,沒有現金送)
國內私募機構九鼎控股打造,九鼎投資是在全國股份轉讓系統掛牌的公眾公司,股票代碼為430719,為“中國PE第一股”,市值超1000億元。
原文地址: http://blog.csdn.net/samlei/article/details/4231496
在ant腳本中對外部ant任務的調用,在多項目管理中特別有用。兩種方法總結一下:
使用antfile、使用exec
一:使用antfile
<target name="copy_lib" description="Copy library files from project1 to project2">
<ant antfile="build.xml"
dir="${project1dir}"
inheritall="false"
inheritrefs="false"
target="copy_to_project2_lib"
/>
</target>
antfile表示子項目的構建文件。
dir表示構建文件所再的目錄,缺省為當前目錄。
inheritall表示父項目的所有屬性在子項目中都可使用,並覆蓋子項目中的同名屬性。缺省為true。
inheritrefs表示父項目中的所有引用在子項目中都可以使用,並且不覆蓋子項目中的同名引用。缺省為false。
如果在ant任務中顯示的定義引用,如上例<reference refid="filter.set">則該引用將會覆蓋子項目中的同名引用。
target表示所要運行的子項目中的target,如果不寫則為缺省target。
二:使用exec
<target name="copy_lib" description="Copy library files from project1 to project2">
<exec executable="cmd.exe">
<arg line="/c "cd ../project1 && ant copy_to_project2_lib " "/>
</exec>
</target>
翻譯為命令行就是:cmd.exe /c "cd ../project && ant copy_to_project2_lib"
意思是直接調用系統控制台,先執行cd命令,再執行ant腳本指定任務,/c 表示執行后續 String 指定的命令,然后停止。