3

我的 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>

到目前为止,这工作得很好。目前,我的两个依赖项使用 META-INF 中某个文件的相同文件名来存储一些数据。不幸的是,插件没有合并文件,它只是用第二个覆盖第一个,这使我的应用程序崩溃。

我可以强制 maven 合并碰巧具有相同名称(但来自不同依赖项)的文件吗?

4

1 回答 1

2

maven-shade-plugin及其转换器我认为就在你的小巷里。

于 2012-08-28T07:05:12.377 回答