在Maven 2中将几个模块(jar)合并到单个jar文件中的最简单方法

Jai*_*zle 0 maven-2 maven

使用maven-shade-plugin,您实际上可以将所有依赖项jar合并到单个jar文件中.但是我只想合并几个jar文件(不是全部),类似于include-only x和y,排除其他文件.

是否有最简单的方法来指定要包含的jar文件,而不是指定要排除的所有jar文件?

Pet*_*lka 5

maven-shade-plugin支持其参数artifactSet中的包含和排除- 是不是按照您的要求工作?

...
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>1.4</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <finalName>${project.artifactId}-shaded</finalName>
                        <artifactSet>
                            <includes>
                                <include>net.sf.buildbox:*</include>
                            </includes>
                        </artifactSet>
                    </configuration>
                </execution>
            </executions>
        </plugin>
...
Run Code Online (Sandbox Code Playgroud)