maven-ear-plugin解包,过滤和重新包装jarModule

时间:2013-08-01 07:39:27

标签: maven-ear-plugin

打包在我的ear文件中的jarModule包含一个persistence.xml文件,我需要将其作为包阶段的一部分删除。我能做的最好的就是:

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


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

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

有什么建议吗?

由于

1 个答案:

答案 0 :(得分: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>

Archives(* .jar,* .war,...)可以像使用TrueZIP的目录一样使用。如usage page所示,您可以轻松地在档案中移动或复制文件。