This is an automated email from the ASF dual-hosted git repository.

pkarwasz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 51b436043cac61e530369f4e233e2c14425a8237
Author: Piotr P. Karwasz <[email protected]>
AuthorDate: Fri Oct 20 16:02:00 2023 +0200

    Ban dependencies interfering with our tests
---
 log4j-core-its/pom.xml                   | 27 ++++++++++++++++++++++-
 log4j-core-test/pom.xml                  | 11 ----------
 log4j-gctests/pom.xml                    | 11 ----------
 log4j-parent/pom.xml                     | 37 ++++++++++++++++++++++++++++++++
 log4j-perf-test/pom.xml                  | 22 +++++++++++++++++++
 log4j-spring-cloud-config-client/pom.xml | 18 ++++++++++++++++
 6 files changed, 103 insertions(+), 23 deletions(-)

diff --git a/log4j-core-its/pom.xml b/log4j-core-its/pom.xml
index 2b38ca60b5..77edc541a0 100644
--- a/log4j-core-its/pom.xml
+++ b/log4j-core-its/pom.xml
@@ -29,7 +29,8 @@
   <name>Apache Log4j Core Integration Tests</name>
   <description>Integration Tests for the Apache Log4j 
Implementation</description>
   <properties>
-    <log4jParentDir>${basedir}/..</log4jParentDir>
+    <docLabel>Core Documentation</docLabel>
+    <projectDir>/core</projectDir>
     <bnd.baseline.skip>true</bnd.baseline.skip>
     <maven.deploy.skip>true</maven.deploy.skip>
     <maven.install.skip>true</maven.install.skip>
@@ -155,6 +156,29 @@
   </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>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-failsafe-plugin</artifactId>
@@ -171,6 +195,7 @@
           
<groups>org.apache.logging.log4j.core.test.categories.PerformanceTests</groups>
         </configuration>
       </plugin>
+
     </plugins>
   </build>
 </project>
diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index 2d9d45e6ab..3f6120db89 100644
--- a/log4j-core-test/pom.xml
+++ b/log4j-core-test/pom.xml
@@ -237,17 +237,6 @@
       <artifactId>log4j2-logstash-layout</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>
     <!-- Mocking framework for use with JUnit -->
     <dependency>
       <groupId>org.mockito</groupId>
diff --git a/log4j-gctests/pom.xml b/log4j-gctests/pom.xml
index 988808c891..fea3ff97e2 100644
--- a/log4j-gctests/pom.xml
+++ b/log4j-gctests/pom.xml
@@ -227,17 +227,6 @@
       <artifactId>log4j2-logstash-layout</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>
     <!-- Mocking framework for use with JUnit -->
     <dependency>
       <groupId>org.mockito</groupId>
diff --git a/log4j-parent/pom.xml b/log4j-parent/pom.xml
index b80bbdc42f..acf39ce8a0 100644
--- a/log4j-parent/pom.xml
+++ b/log4j-parent/pom.xml
@@ -973,6 +973,43 @@
         </executions>
       </plugin>
 
+      <!--
+        ~ 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>
+
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
diff --git a/log4j-perf-test/pom.xml b/log4j-perf-test/pom.xml
index d00fbf0a24..92e055ea94 100644
--- a/log4j-perf-test/pom.xml
+++ b/log4j-perf-test/pom.xml
@@ -143,6 +143,28 @@
           </annotationProcessorPaths>
         </configuration>
       </plugin>
+
+      <!--
+        ~ 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>
diff --git a/log4j-spring-cloud-config-client/pom.xml 
b/log4j-spring-cloud-config-client/pom.xml
index af48870405..d93aef6e3d 100644
--- a/log4j-spring-cloud-config-client/pom.xml
+++ b/log4j-spring-cloud-config-client/pom.xml
@@ -94,6 +94,12 @@
     <dependency>
       <groupId>org.springframework.cloud</groupId>
       <artifactId>spring-cloud-config-client</artifactId>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-jcl</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
@@ -117,12 +123,24 @@
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-test</artifactId>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-jcl</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
     <dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-starter-log4j2</artifactId>
       <scope>test</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.springframework</groupId>
+          <artifactId>spring-jcl</artifactId>
+        </exclusion>
+      </exclusions>
     </dependency>
 
   </dependencies>

Reply via email to