2013-05-16 48 views
0

請原諒我詢問簡單的問題。我是新來的螞蟻,我想建立一個jar文件。我有一個文件將文件打包到特定目錄下的jar中

jaxb.in​​dex

封裝結構內部

COM/MYCOM /毫克/適配器

我想這個打包成文件我的罐子使用

<target name="dist" description="Create distributable jar file"> 
    <jar destfile="${common.lib.dir}/${dist.file}"> 
     <fileset dir="${build.classes.dir}"/> 
     <zipfileset 
      file="${sms.syn.dir}/jaxb.index"> 
     </zipfileset> 
    </jar> 
</target> 

我想要在同一個包com/mycom/mg/adapter中的jaxb.in​​dex文件,但是當我使用上面的代碼時,ant將它添加到jar的根目錄。誰能幫我嗎?

編輯 使用

<zipfileset 
      file="${sms.syn.dir}/jaxb.index" fullpath="com/mycom/mg/adapter"> 
</zipfileset> 

犯規幫助的。

回答

2

看來,你應該使用屬性prefix代替fullpath

<zipfileset 
      file="${sms.syn.dir}/jaxb.index" prefix="com/mycom/mg/adapter"> 
</zipfileset> 

我認爲fullpath應該也行,但你應該指定真正完整路徑,即與文件名路徑:fullpath="com/mycom/mg/adapter/jaxb.index"

1

您可能需要這樣使用

<zipfileset dir="${sms.syn.dir}" includes="jaxb.index" fullpath="com/mycom/mg/adapter"/> 
+0

謝謝。我只需要將文件名jaxb.in​​dex添加到完整路徑屬性,如AlexR所示 – CuriousCoder

相關問題