0

a jarModule that is packaged in my ear file contains a persistence.xml file that I need to remove as part of the package phase. The best I can do is with:

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


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

but I need the jar to be repacked before the packaging the ear.

Any suggestions?

Thanks

user2641043
  • 405
  • 3
  • 12

1 Answers1

0

You can use the TrueZIP Maven PLugin to remove files from an archive:

<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, ...) can be used like directories with TrueZIP. As shown on the usage page you can move or copy files in archives easily.

leo
  • 1
  • 2