2017-02-28 100 views
0

我遇到了一個Ant構建文件的問題。整個配置是遺留的,我對螞蟻​​並不是很熟悉,所以我嘗試了螞蟻手冊並搜索interwebs,但我仍然沒有滿意的答案。我有這樣的片段:在螞蟻中包含多個文件擴展名

 <jar destfile="${dist.dir}/${ivy.module}.jar"> 
      <fileset dir="${build.classes.dir}"/> 
      <restrict> 
       <name name="**/*.class"/> 
       <archives> 
        <zips> 
         <fileset dir="${build.lib.dir}" includes="**/*.jar"/> 
        </zips> 
       </archives> 
      </restrict> 
      <manifest> 
       <attribute name="Manifest-Version" value="1.0"/> 
       <attribute name="Created-By" value="${version} (${verndor.name})"/> 
       <attribute name="Client-Version" value="${version}"/> 
       <attribute name="Build-Number" value="${custom.build-number}"/> 
       <attribute name="Main-Class" value="${main.class}"/> 
      </manifest> 
     </jar> 

我也想包括將「* .so」文件(JNI使用),而不是僅僅的.class從提取的存檔文件。什麼是最好的方式來做到這一點?正如我所說的,螞蟻手冊相當模糊。

由於提前

+0

的[文件集文檔(http://ant.apache.org/manual/Types/fileset.html)指出,'includes'屬性包含「逗號或必須包含的空格分隔的文件模式列表。「對我來說,這似乎並不模糊。 – VGR

+0

感謝您的回答,但我不是在談論那包含部分。 afaik include語句是爲了選擇所有的.jar文件, ,但是正如我所看到的那樣,標記實際上用於過濾所有.class文件罐子拉到新的罐子裏,在這裏我不知道如何改變過濾器。我已經嘗試更改名稱標籤,如下所示:但是那些罐子裏的所有東西都被排除了。 –

+0

我的錯誤,我誤讀。 – VGR

回答

0

<restrict> documentation列出了可能的嵌套選擇。您可以使用<or>指定多個模式:

<restrict> 
    <or> 
     <name name="*.class"/> 
     <name name="path/to/libsomething.so"/> 
    </or>