ppkarwasz commented on issue #1386: URL: https://github.com/apache/logging-log4j2/issues/1386#issuecomment-1481686029
@yvasyliev, By shading multiple JAR files into one you break many things necessary for the correct behavior of Log4j2 (multi-release to run on Java 9+, plugin caches to use components without scanning packages, etc.). For all these to work you need the `maven-shade-plugin` and multiiple transformers. A sample configuration can be found in [our samples repository](https://github.com/apache/logging-log4j-samples/blob/main/log4j-samples-asynclogger/pom.xml). The most important bits are: ```lang-xml <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <dependencies> <dependency> <groupId>io.github.edwgiz</groupId> <artifactId>log4j-maven-shade-plugin-extensions</artifactId> <version>2.20.0</version> </dependency> </dependencies> <configuration> <transformers> <transformer implementation="io.github.edwgiz.log4j.maven.plugins.shade.transformer.Log4j2PluginCacheFileTransformer"/> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>org.apache.logging.log4j.samples.async.Log4J2AsyncLogger</mainClass> <manifestEntries> <Multi-Release>true</Multi-Release> </manifestEntries> </transformer> </transformers> </configuration> </plugin> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
