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.
<br /> <plugin><br /> <groupId>org.apache.maven.plugins</groupId><br /> <artifactId>maven-shade-plugin</artifactId><br /> <version>2.4.1</version><br /> <executions><br /> <execution><br /> <phase>package</phase><br /> <goals><br /> <goal>shade</goal><br /> </goals><br /> <configuration><br /> <transformers><br /> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"><br /> <manifestEntries><br /> <Main-Class>MainClass</Main-Class><br /> </manifestEntries><br /> </transformer><br /> </transformers><br /> </configuration><br /> </execution><br /> </executions><br /> </plugin><br />