I have used maven-dependency-plugin 2.8 which is bringing in log4j 1.2.12
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${version.maven-checkstyle-plugin}</version>
<configuration>
<m2eclipseConfig>
<!-- To prevent the eclipse-checkstyle-plugin, to update the configured
Checkstyle see refrence https://code.google.com/p/m2e-extensions/wiki/Checkstyle -->
<disable>true</disable>
</m2eclipseConfig>
<rules>
<bannedDependencies>
<excludes>
<exclude>log4j:log4j</exclude>
</excludes>
</bannedDependencies>
</rules>
<fail>true</fail>
</configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>6.18</version>
</dependency>
</dependencies>
<executions>
<execution>
<!-- The checkstyle goal is tied to the Verify phase. When violations
are found the build is not broken. Verify stand for : Run any checks to verify
the package is valid and meets quality criteria. -->
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
The dependency looks like maven-dependency-plugin:jar:2.8 -> org.apache.maven.shared:maven-common-artifact-filters:jar:1.4 -> org.codehaus.plexus:plexus-container-default:jar:1.5.5 -> org.apache.xbean:xbean-reflect:jar:3.4 -> log4j:log4j:jar:1.2.12
I want to remove log4j coming in from the dependency.