log4j2 issues with maven assembly plugin

I was working on a project and we needed an executable jar will the dependencies in. So I googled and found maven-assembly-plugin. So I took the plugin and used it build my executable jar. After running the executable the log4j2 stopped to work. I tried to build the executable with log4j2.xml in src/main/resources but the log4j2 still complained about the config file not found and I once again passesd the log4j2.xml in the param -Dlog4j.configurationFile and it still didnot work. So after wasting half a day I started googling and found maven-shade-plugin. Once I used the maven-shade-plugin log4j2 started to work again without anything else to be done.

                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.