2012-09-25 35 views
1

這裏是我的螞蟻應用任務:如何分辨螞蟻應用任務目標

<apply executable="${7z.exec}" failonerror="true"> 
    <arg value="x"/> 
    <fileset dir="${distdir}"> 
    <include name="**/*.zip"/> 
    </fileset> 
</apply> 

7z.exec是對7z.exe可執行文件的絕對路徑。我怎樣才能告訴7zip將解壓縮後的文件放入與.zip相同的文件夾?

回答

1

您需要使用7z -o switch for the eXtract command和Ant mapper才能獲取zip的路徑。 Ant apply task有一個targetfile元素,可以讓您在爲任務編寫命令行時有更大的靈活性。導致類似於:

<apply executable="${7z.exec}" failonerror="true"> 
    <arg value="x"/> 
    <srcfile /> 
    <targetfile prefix="-o" /> 
    <mapper type="regexp" from="^(.*)/(.*\.zip)" to="\1" /> 

    <fileset dir="${distdir}"> 
    <include name="**/*.zip"/> 
    </fileset> 
</apply> 
+0

這沒有奏效。當我運行我的螞蟻腳本時,應用程序沒有做任何事情。 – rohitsan

+0

很抱歉聽到這個!我建議你在詳細模式下運行ant(-v命令行選項),它將向您顯示應用任務試圖運行的命令。如果它根本沒有運行,那麼文件集中可能存在錯誤。我對7z不熟悉,但是可能您的版本沒有x命令的-o選項。讓我知道你找到了什麼,我會盡量提供更多的建議。 –