Skip to content

Commit 463e791

Browse files
committed
Clean up log4j-spring-cloud-config-client dependencies
We minimize the dependencies of `log4j-spring-cloud-config-client` to those really required: `spring-context` and `spring-cloud-context`. The dependency on `spring-boot-autoconfigure` is optional (its just used in annotations) and the artifact can be also used without Spring Boot. Fixes #2157.
1 parent 64226fe commit 463e791

File tree

2 files changed

+72
-69
lines changed

2 files changed

+72
-69
lines changed

log4j-parent/pom.xml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@
153153
<pax-exam.version>4.13.5</pax-exam.version>
154154
<plexus-utils.version>3.5.1</plexus-utils.version>
155155
<slf4j.version>2.0.10</slf4j.version>
156+
<spring-boot.version>3.2.1</spring-boot.version>
157+
<spring-cloud.version>4.1.0</spring-cloud.version>
158+
<spring-framework.version>6.1.2</spring-framework.version>
156159
<system-stubs.version>2.1.5</system-stubs.version>
157160
<tomcat-juli.version>10.1.17</tomcat-juli.version>
158161
<velocity.version>1.7</velocity.version>
@@ -252,6 +255,14 @@
252255
<scope>import</scope>
253256
</dependency>
254257

258+
<dependency>
259+
<groupId>org.springframework</groupId>
260+
<artifactId>spring-framework-bom</artifactId>
261+
<version>${spring-framework.version}</version>
262+
<type>pom</type>
263+
<scope>import</scope>
264+
</dependency>
265+
255266
<dependency>
256267
<groupId>org.mockito</groupId>
257268
<artifactId>mockito-bom</artifactId>
@@ -813,6 +824,24 @@
813824
<version>${slf4j.version}</version>
814825
</dependency>
815826

827+
<dependency>
828+
<groupId>org.springframework.boot</groupId>
829+
<artifactId>spring-boot-autoconfigure</artifactId>
830+
<version>${spring-boot.version}</version>
831+
</dependency>
832+
833+
<dependency>
834+
<groupId>org.springframework.boot</groupId>
835+
<artifactId>spring-boot-test</artifactId>
836+
<version>${spring-boot.version}</version>
837+
</dependency>
838+
839+
<dependency>
840+
<groupId>org.springframework.cloud</groupId>
841+
<artifactId>spring-cloud-context</artifactId>
842+
<version>${spring-cloud.version}</version>
843+
</dependency>
844+
816845
<dependency>
817846
<groupId>uk.org.webcompere</groupId>
818847
<artifactId>system-stubs-core</artifactId>

log4j-spring-cloud-config-client/pom.xml

Lines changed: 43 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -38,79 +38,40 @@
3838
~ OSGi and JPMS options
3939
-->
4040
<bnd-module-name>org.apache.logging.log4j.spring.cloud.config.client</bnd-module-name>
41+
<bnd-extra-packages-options>
42+
<!-- Used only for annotations -->
43+
org.springframework.boot.autoconfigure;resolution:=optional
44+
</bnd-extra-packages-options>
4145
<bnd-extra-module-options>
46+
<!-- Optional dependencies should not be transitive -->
47+
spring.boot.autoconfigure;transitive=false,
4248
<!-- Filebased module names: MUST be static -->
4349
spring.cloud.context;substitute="spring-cloud-context";static=true;transitive=false
4450
</bnd-extra-module-options>
4551
<Fragment-Host>org.apache.logging.log4j.core</Fragment-Host>
46-
47-
<!-- dependency versions -->
48-
<spring-boot.version>3.2.1</spring-boot.version>
49-
<spring-cloud.version>2022.0.4</spring-cloud.version>
50-
5152
</properties>
5253

53-
<dependencyManagement>
54-
<dependencies>
55-
56-
<dependency>
57-
<groupId>org.springframework.boot</groupId>
58-
<artifactId>spring-boot-dependencies</artifactId>
59-
<version>${spring-boot.version}</version>
60-
<type>pom</type>
61-
<scope>import</scope>
62-
</dependency>
63-
64-
<dependency>
65-
<groupId>org.springframework.cloud</groupId>
66-
<artifactId>spring-cloud-dependencies</artifactId>
67-
<version>${spring-cloud.version}</version>
68-
<type>pom</type>
69-
<scope>import</scope>
70-
</dependency>
71-
72-
<dependency>
73-
<groupId>org.springframework.boot</groupId>
74-
<artifactId>spring-boot-starter-test</artifactId>
75-
<version>${spring-boot.version}</version>
76-
<exclusions>
77-
<exclusion>
78-
<groupId>org.springframework.boot</groupId>
79-
<artifactId>spring-boot-starter-logging</artifactId>
80-
</exclusion>
81-
</exclusions>
82-
</dependency>
83-
84-
</dependencies>
85-
</dependencyManagement>
86-
8754
<dependencies>
8855

8956
<dependency>
90-
<groupId>org.apache.logging.log4j</groupId>
91-
<artifactId>log4j-core</artifactId>
57+
<groupId>org.springframework.boot</groupId>
58+
<artifactId>spring-boot-autoconfigure</artifactId>
59+
<scope>provided</scope>
9260
</dependency>
9361

9462
<dependency>
95-
<groupId>org.springframework.cloud</groupId>
96-
<artifactId>spring-cloud-config-client</artifactId>
97-
<exclusions>
98-
<exclusion>
99-
<groupId>org.springframework</groupId>
100-
<artifactId>spring-jcl</artifactId>
101-
</exclusion>
102-
</exclusions>
63+
<groupId>org.apache.logging.log4j</groupId>
64+
<artifactId>log4j-core</artifactId>
10365
</dependency>
10466

10567
<dependency>
106-
<groupId>org.springframework.cloud</groupId>
107-
<artifactId>spring-cloud-starter-bootstrap</artifactId>
68+
<groupId>org.springframework</groupId>
69+
<artifactId>spring-context</artifactId>
10870
</dependency>
10971

11072
<dependency>
111-
<groupId>commons-logging</groupId>
112-
<artifactId>commons-logging</artifactId>
113-
<scope>runtime</scope>
73+
<groupId>org.springframework.cloud</groupId>
74+
<artifactId>spring-cloud-context</artifactId>
11475
</dependency>
11576

11677
<dependency>
@@ -126,29 +87,42 @@
12687
</dependency>
12788

12889
<dependency>
129-
<groupId>org.springframework.boot</groupId>
130-
<artifactId>spring-boot-starter-test</artifactId>
90+
<groupId>org.springframework</groupId>
91+
<artifactId>spring-test</artifactId>
13192
<scope>test</scope>
132-
<exclusions>
133-
<exclusion>
134-
<groupId>org.springframework</groupId>
135-
<artifactId>spring-jcl</artifactId>
136-
</exclusion>
137-
</exclusions>
13893
</dependency>
13994

14095
<dependency>
14196
<groupId>org.springframework.boot</groupId>
142-
<artifactId>spring-boot-starter-log4j2</artifactId>
97+
<artifactId>spring-boot-test</artifactId>
14398
<scope>test</scope>
144-
<exclusions>
145-
<exclusion>
146-
<groupId>org.springframework</groupId>
147-
<artifactId>spring-jcl</artifactId>
148-
</exclusion>
149-
</exclusions>
15099
</dependency>
151100

152101
</dependencies>
153102

103+
<build>
104+
<plugins>
105+
<!--
106+
~ Unban Spring JCL, so we don't need to exclude it.
107+
-->
108+
<plugin>
109+
<groupId>org.apache.maven.plugins</groupId>
110+
<artifactId>maven-enforcer-plugin</artifactId>
111+
<executions>
112+
<execution>
113+
<id>ban-logging-dependencies</id>
114+
<configuration>
115+
<rules>
116+
<bannedDependencies>
117+
<includes>
118+
<include>org.springframework:spring-jcl</include>
119+
</includes>
120+
</bannedDependencies>
121+
</rules>
122+
</configuration>
123+
</execution>
124+
</executions>
125+
</plugin>
126+
</plugins>
127+
</build>
154128
</project>

0 commit comments

Comments
 (0)