好吧,我发现这个问题,这个问题。
简而言之,当使用maven shade plugin将应用程序类打包在uber
jar中时,就会出现问题。虽然该
log4j2版本
2.8.1的修复程序仍在进行中,但建议的解决方法是
pom.xml使用阴影插件的额外配置设置来更新Maven
,如下所示:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> . . . . . <build> . . . . . <plugins> . . . . . <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>2.4.1</version> <configuration> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>meta-INF/*.SF</exclude> <exclude>meta-INF/*.DSA</exclude> <exclude>meta-INF/*.RSA</exclude> </excludes> </filter> </filters> <transformers> <transformer implementation="com.github.edwgiz.mavenShadePlugin.log4j2CacheTransformer.PluginsCacheFileTransformer"/> </transformers> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>com.github.edwgiz</groupId> <artifactId>maven-shade-plugin.log4j2-cachefile-transformer</artifactId> <version>2.1</version> </dependency> </dependencies> </plugin> . . . . . </plugins> . . . . . </build> . . . . . <pluginRepositories> <pluginRepository> <id>oss.sonatype.org</id> <name>OSS Sonatype Staging</name> <url>https://oss.sonatype.org/content/groups/staging</url> </pluginRepository> </pluginRepositories> . . . . . </project>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)