Skip to content

Commit

Permalink
Ban dependencies interfering with our tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ppkarwasz committed Oct 20, 2023
1 parent a73c4fa commit f303f2d
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 48 deletions.
10 changes: 0 additions & 10 deletions log4j-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.cassandra</groupId>
Expand Down
18 changes: 6 additions & 12 deletions log4j-core-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,6 @@
<artifactId>log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<!-- Logback performance tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<!-- SLF4J tests -->
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -179,7 +168,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
Expand Down
17 changes: 6 additions & 11 deletions log4j-core-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JNDI and JMS tests -->
<dependency>
Expand Down Expand Up @@ -278,17 +284,6 @@
<artifactId>kafka-clients</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<!-- Logback performance tests -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
Expand Down
7 changes: 6 additions & 1 deletion log4j-jakarta-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down
10 changes: 0 additions & 10 deletions log4j-osgi-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,6 @@
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
Expand Down
67 changes: 67 additions & 0 deletions log4j-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,24 @@
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-all</artifactId>
<version>${cassandra.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand All @@ -338,6 +356,16 @@
<groupId>org.apache.cassandra</groupId>
<artifactId>cassandra-thrift</artifactId>
<version>${cassandra.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -1077,6 +1105,45 @@

</plugins>
</pluginManagement>

<plugins>
<!--
~ Some external logging bridges can interfere with our tests, giving false negatives.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>ban-logging-dependencies</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<bannedDependencies>
<excludes>
<!-- JCL replacements -->
<exclude>org.slf4j:jcl-over-slf4j</exclude>
<exclude>org.springframework:spring-jcl</exclude>
<!-- Log4j 1.x replacements -->
<exclude>org.slf4j:log4j-over-slf4j</exclude>
<exclude>ch.qos.reload4j:reload4j</exclude>
<!-- Bridges to Log4j 1.x -->
<exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-reload4j</exclude>
<!-- PAX Logging just to be safe -->
<exclude>org.ops4j.pax.logging:*</exclude>
<!-- Logback -->
<exclude>ch.qos.logback:*</exclude>
</excludes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
24 changes: 22 additions & 2 deletions log4j-perf-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,10 @@
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
Expand All @@ -144,6 +142,28 @@
<build>
<plugins>

<!--
~ Unban Logback.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>ban-logging-dependencies</id>
<configuration>
<rules>
<bannedDependencies>
<includes>
<include>ch.qos.logback:*</include>
</includes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand Down
6 changes: 6 additions & 0 deletions log4j-spring-boot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
Expand Down
7 changes: 6 additions & 1 deletion log4j-taglib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
26 changes: 26 additions & 0 deletions log4j-to-slf4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,30 @@
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<!--
~ Unban Logback.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>ban-logging-dependencies</id>
<configuration>
<rules>
<bannedDependencies>
<includes>
<include>ch.qos.logback:*:*:*:test</include>
</includes>
</bannedDependencies>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
7 changes: 6 additions & 1 deletion log4j-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,12 @@
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring-jcl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>

Expand Down

0 comments on commit f303f2d

Please sign in to comment.