2016-01-30 64 views
0

嗨我正在使用螞蟻戰爭插件,並試圖從戰爭中排除文件夾。然而這並不排除在外。螞蟻戰爭插件試圖排除文件夾

這裏是結構

XYZ 
     src 
     main 
      webapp 
        web-inf 
         web.xml 
        common 
         api 
          a.js 
          b.js 

我的目標=生產build.xml文件看起來是這樣的,我嘗試排除德共同文件夾。不過,我看到它是不是在所有

<target name="production" depends="moveresources" 
     description="Building the Production Directory Content"> 
    <echo message="Creating -> ${workingDirectory}"/> 
    <war destfile="${workingDirectory}/horizonadmin.war" webxml="${srcDirectory}/WEB-INF/web.xml"> 
     <fileset dir="${webappsrc}"/> 
     <lib dir="${srcDirectory}/WEB-INF/lib"/> 
     <classes dir="${srcDirectory}/WEB-INF/classes"/> 
     <exclude name="common/api/*.js/> 
    </war> 
    <echo message="Done Creating -> ${workingDirectory}"/> 
</target> 
在我的pom.xml

排除它,我已經引用的文件夾

<plugin> 
    <artifactId>maven-antrun-plugin</artifactId> 
    <executions> 
    <execution> 
     <id>production</id> 
     <phase>package</phase> 
     <goals> 
     <goal>run</goal> 
     </goals> 
     <configuration> 
     <target> 
      <property name="unpackfolder" value="${unpack.folder}"/> 
      <property name="webappsrc" value="src/main/webapp"/> 
      <property name="srcDirectory" value="${project.basedir}/target"/> 
      <property name="workingDirectory" value="${PUBLISH_DIR}/production"/> 
      <ant antfile="${project.basedir}/build.xml" target="production"/> 
     </target> 
     </configuration> 
    </execution> 

,如何排除在我的戰爭文件,這些js文件?用於生產模式。我打算排除這些js文件幷包含縮小的js文件。任何指針

+1

有什麼特別的原因,你沒有使用'maven-war-plugin'?這會容易很多。 – Tunaki

回答

1

附上<exclude><fileset>

<fileset dir="${webappsrc}"> 
    <exclude name="common/api/*.js" /> 
</fileset> 
0

exclude你直接無法嵌套到fileset S的一個適用於隱性fileset任務表單當您使用basedir屬性裏面的任務添加。沒有任何basedir它不會做任何事情。這可能不在war文檔中提及,但在鏈接的jar頁面內。

您必須將exclude放在fileset的內部,以吸引不需要的文件。 libclassesfileset,它們具有不同的名稱(它們實際上只是zipfileset,具有硬編碼的prefix屬性)。