配置 Maven Shade minimizeJar 以包含类文件
我正在尝试通过使用的.来最小化UberJar的大小。它看起来只包括在代码中静态导入的类(我怀疑这是因为我在uber jar中看到,但没有包含包的类,因此当我运行uber-jar时抛出)。Maven Shade Plugin
minimizeJar
minimizeJar
LogFactory.class
org\apache\commons\logging\
impl
java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl
有没有办法告诉Maven的Shade插件将指定的软件包包含在最终的jar中,无论建议如何?minimizeJar
以下是我正在尝试的 pom 片段:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<filters>
<filter>
<artifact>commons-logging:commons-logging</artifact>
<includes>
<include>org/apache/commons/logging/**</include>
</includes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myproject.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>