2013-08-01 29 views
0

打包在我的ear文件中的jarModule包含一個persistence.xml文件,我需要將其作爲包階段的一部分刪除。我能做的最好的是:maven-ear-plugin解包,過濾和重新包裝jarModule

<JarModule> 
<groupId>groupId</groupId> 
<artifactId>artifactId</artifactId> 
<unpack>true</unpack> --> 
</JarModule> 


<packagingExcludes>*/META-INF/persistence.xml,*/META-INF/orm.xml</packagingExcludes> 

但我需要在包裝耳朵之前重新包裝罐子。

有什麼建議嗎?

感謝

回答

0

可以使用TrueZIP Maven PLugin從檔案中刪除文件:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>truezip-maven-plugin</artifactId> 
      <version>1.2</version> 
      <executions> 
       <execution> 
        <id>remove-from-jar</id> 
        <phase>prepare-package</phase> 
        <goals> 
         <goal>remove</goal> 
        </goals> 
        <configuration> 
         <fileset> 
          <directory>${project.build.directory}\<someFolders>\<I-contain-persistence-xml.jar></directory> 
          <includes> 
           <include>**\persistence.xml</include> 
           <include>**\orm.xml</include> 
          </includes> 
         </fileset> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

檔案(的* .jar,*的.war,...)可用於像TrueZIP目錄。如usage page所示,您可以輕鬆移動或複製檔案中的文件。

+0

謝謝,這看起來不錯! – user2641043