Queequeg
Queequeg

Reputation: 2864

Maven jar-with-dependencies don't overwrite files

I have this plugin in my pom.file:

      <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <id>package-jar-with-dependencies</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <appendAssemblyId>false</appendAssemblyId>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                        <archive>
                            <manifest>
                                <mainClass>com.doesntwork.App</mainClass>
                            </manifest>
                        </archive>
                    </configuration>
                </execution>
            </executions>
        </plugin>

This worked just fine until now. Currently two of my dependencies use the same filename of some file in META-INF to store some data. Unfortunately the plugin doesn't merge the files, it simply overwrites the first one with the second, which makes my application crash.

Can I force maven to merge the files that happen to have the same name (but are from different dependencies) ?

Upvotes: 3

Views: 1485

Answers (1)

Charlie
Charlie

Reputation: 7349

The maven-shade-plugin and its transformers I think would be right up your alley.

Upvotes: 2

Related Questions