Search code examples
mavenjarjar

Using Maven-JarJar plugin


I'm trying to use the Maven JarJar plugin but I'm having problems. What I'm trying to do is include the Jackson library as part of my "jar-with-dependcies".

Since I couldn't find a help I'm trying to guess the configuration. Can you please have a look and tell my what I'm doing wrong?

This is the configuration:

<plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>jarjar-maven-plugin</artifactId>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>jarjar</goal>
                    </goals>
                    <configuration>
                        <includes>
                            <include>com.fasterxml.jackson.core:jackson-core</include>
                            <include>com.fasterxml.jackson.core:jackson-databind</include>
                            <include>com.fasterxml.jackson.core:jackson-annotations</include>
                        </includes> 
                        <rules>
                            <rule>
                                <pattern>com.fasterxml.jackson.**</pattern>
                                <result>${my.package.prefix}.com.fasterxml.jackson.@1</result>
                            </rule>
                        </rules>
                    </configuration>
                </execution>
            </executions>
        </plugin>

When I'm compiling, I'm getting the following message:

Cleaning up unclosed ZipFile for archive C:\Work\Projects\XXXX\target\xxxx-1.0.0-SNAPSHOT.jar[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.6:single (assemble-all) on project xxxx: Failed to create assembly: Error creating assembly archive jar-with-dependencies: Problem creating jar: jar:file:/C:/Work/Projects/XXXX/target/xxxx-1.0.0-SNAPSHOT.jar!/META-INF/aop.xml: JAR entry META-INF/aop.xml not found in C:\Work\Projects\XXXX\target\xxxx-1.0.0-SNAPSHOT.jar -> [Help 1]

I'll appreciate your help!


Solution

  • In the end I didn't use the maven-jarjar-plugin. I've used JarJar's JAR itself. The answer of the following question describes the solution:

    Relocating fastxml.jackson classes to my.package.fastxml.jackson