Skip to content

Instantly share code, notes, and snippets.

@jaxzin
Created April 19, 2011 18:59
Show Gist options
  • Save jaxzin/929276 to your computer and use it in GitHub Desktop.
Save jaxzin/929276 to your computer and use it in GitHub Desktop.
Ban logging dependencies that collide with slf4j or your chosen logging implementation.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0-alpha-3</version>
<executions>
<execution>
<id>ban-other-loggers</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<searchTransitive>true</searchTransitive>
<excludes>
<!-- Ban the secondary frameworks -->
<exclude>log4j:log4j</exclude>
<exclude>commons-logging</exclude>
<!-- Ban other slf4j bridges so
we don't end up in an infinite loop -->
<exclude>org.slf4j:slf4j-log4j12</exclude>
</excludes>
<message>Secondary logging frameworks are
banned in preference to org.slf4j:*-over-slf4j</message>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment