Skip to content

Commit 1d9aa8d

Browse files
committed
Fix build
1 parent 6e295b3 commit 1d9aa8d

File tree

4 files changed

+167
-34
lines changed

4 files changed

+167
-34
lines changed

jul-to-log4j-api/pom.xml

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,23 @@
1919
<modelVersion>4.0.0</modelVersion>
2020
<parent>
2121
<groupId>org.apache.logging.log4j</groupId>
22-
<artifactId>log4j</artifactId>
22+
<artifactId>log4j-jdk-parent</artifactId>
2323
<version>${revision}</version>
24-
<relativePath>../log4j-parent</relativePath>
24+
<relativePath>../parent</relativePath>
2525
</parent>
2626

27-
<artifactId>jul-to-log4j</artifactId>
28-
<name>Apache Log4j JUL LogManager</name>
27+
<artifactId>jul-to-log4j-api</artifactId>
28+
<name>JUL to Log4j API logging bridge</name>
2929
<description>A `java.util.logging` LogManager that forwards events to the Log4j API.</description>
3030

3131
<properties>
32+
<!-- Skips BND Baseline until the first release -->
33+
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
34+
35+
<!-- TODO: Adapt to Java 9 -->
36+
<maven.compiler.release>17</maven.compiler.release>
37+
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
38+
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>
3239
<!--
3340
~ OSGi and JPMS options
3441
-->
@@ -40,6 +47,9 @@
4047
<!-- Optional modules can not be `transitive` -->
4148
org.jspecify;transitive=false
4249
</bnd-extra-module-options>
50+
51+
<!-- Dependency versions -->
52+
<log4j.version>3.0.0-SNAPSHOT</log4j.version>
4353
</properties>
4454

4555
<dependencies>
@@ -60,18 +70,6 @@
6070
<scope>test</scope>
6171
</dependency>
6272

63-
<dependency>
64-
<groupId>org.hamcrest</groupId>
65-
<artifactId>hamcrest</artifactId>
66-
<scope>test</scope>
67-
</dependency>
68-
69-
<dependency>
70-
<groupId>junit</groupId>
71-
<artifactId>junit</artifactId>
72-
<scope>test</scope>
73-
</dependency>
74-
7573
<dependency>
7674
<groupId>org.apache.logging.log4j</groupId>
7775
<artifactId>log4j-async-logger</artifactId>
@@ -89,29 +87,14 @@
8987
<artifactId>log4j-core-test</artifactId>
9088
<scope>test</scope>
9189
</dependency>
90+
9291
</dependencies>
9392

9493
<build>
9594
<plugins>
9695
<plugin>
9796
<groupId>org.apache.maven.plugins</groupId>
9897
<artifactId>maven-surefire-plugin</artifactId>
99-
<configuration>
100-
<systemPropertyVariables>
101-
<java.awt.headless>true</java.awt.headless>
102-
</systemPropertyVariables>
103-
<argLine>-Xms256m -Xmx1024m</argLine>
104-
<forkCount>1</forkCount>
105-
<reuseForks>false</reuseForks>
106-
</configuration>
107-
<dependencies>
108-
<!-- The `surefire-junit-platform` provider initializes JUL before tests start -->
109-
<dependency>
110-
<groupId>org.apache.maven.surefire</groupId>
111-
<artifactId>surefire-junit47</artifactId>
112-
<version>${surefire.version}</version>
113-
</dependency>
114-
</dependencies>
11598
<executions>
11699
<execution>
117100
<id>default-test</id>
@@ -120,12 +103,50 @@
120103
</goals>
121104
<phase>test</phase>
122105
<configuration>
106+
<excludes>
107+
<exclude>**/AsyncLoggerThreadsTest.class</exclude>
108+
<exclude>**/CustomLoggerAdapterTest.class</exclude>
109+
</excludes>
123110
<!-- Use custom `j.u.l.LogManager` -->
124111
<systemPropertyVariables>
125112
<java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager>
126113
</systemPropertyVariables>
127114
</configuration>
128115
</execution>
116+
<execution>
117+
<id>async-logger-test</id>
118+
<goals>
119+
<goal>test</goal>
120+
</goals>
121+
<phase>test</phase>
122+
<configuration>
123+
<includes>
124+
<include>**/AsyncLoggerThreadsTest.class</include>
125+
</includes>
126+
<!-- Use custom `j.u.l.LogManager` and an asynchronous selector -->
127+
<systemPropertyVariables>
128+
<java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager>
129+
<log4j.loggerContext.selector>org.apache.logging.log4j.async.logger.AsyncLoggerContextSelector</log4j.loggerContext.selector>
130+
</systemPropertyVariables>
131+
</configuration>
132+
</execution>
133+
<execution>
134+
<id>custom-logger-adapter-test</id>
135+
<goals>
136+
<goal>test</goal>
137+
</goals>
138+
<phase>test</phase>
139+
<configuration>
140+
<includes>
141+
<include>**/CustomLoggerAdapterTest.class</include>
142+
</includes>
143+
<!-- Use custom `j.u.l.LogManager` and a custom adapter -->
144+
<systemPropertyVariables>
145+
<java.util.logging.manager>org.apache.logging.jul.tolog4j.LogManager</java.util.logging.manager>
146+
<log4j.jul.loggerAdapter>org.apache.logging.jul.tolog4j.test.support.CustomLoggerAdapterTest$CustomLoggerAdapter</log4j.jul.loggerAdapter>
147+
</systemPropertyVariables>
148+
</configuration>
149+
</execution>
129150
</executions>
130151
</plugin>
131152
</plugins>

parent/pom.xml

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,87 @@
3232

3333
<properties>
3434

35+
<!-- Use a baseline of Java 9 -->
36+
<maven.compiler.release>9</maven.compiler.release>
37+
<maven.compiler.source>${maven.compiler.release}</maven.compiler.source>
38+
<maven.compiler.target>${maven.compiler.release}</maven.compiler.target>
39+
3540
<!-- dependency versions -->
41+
<assertj.version>3.26.3</assertj.version>
42+
<bnd.annotation.version>7.0.0</bnd.annotation.version>
43+
<hamcrest.version>2.2</hamcrest.version>
44+
<jspecify.version>1.0.0</jspecify.version>
45+
<junit.version>5.11.3</junit.version>
3646
<log4j.version>2.24.1</log4j.version>
47+
<osgi.bundle.version>2.0.0</osgi.bundle.version>
48+
<osgi.versioning.version>1.1.2</osgi.versioning.version>
3749

3850
</properties>
3951

4052
<dependencyManagement>
4153
<dependencies>
4254

55+
<dependency>
56+
<groupId>org.hamcrest</groupId>
57+
<artifactId>hamcrest</artifactId>
58+
<version>${hamcrest.version}</version>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>org.assertj</groupId>
63+
<artifactId>assertj-bom</artifactId>
64+
<version>${assertj.version}</version>
65+
<type>pom</type>
66+
<scope>import</scope>
67+
</dependency>
68+
4369
<dependency>
4470
<groupId>org.apache.logging.log4j</groupId>
45-
<artifactId>log4j-api</artifactId>
71+
<artifactId>log4j-bom</artifactId>
4672
<version>${log4j.version}</version>
73+
<type>pom</type>
74+
<scope>import</scope>
75+
</dependency>
76+
77+
<dependency>
78+
<groupId>org.junit</groupId>
79+
<artifactId>junit-bom</artifactId>
80+
<version>${junit.version}</version>
81+
<type>pom</type>
82+
<scope>import</scope>
4783
</dependency>
4884

4985
</dependencies>
5086
</dependencyManagement>
5187

88+
<dependencies>
89+
90+
<dependency>
91+
<groupId>biz.aQute.bnd</groupId>
92+
<artifactId>biz.aQute.bnd.annotation</artifactId>
93+
<version>${bnd.annotation.version}</version>
94+
<scope>provided</scope>
95+
</dependency>
96+
97+
<dependency>
98+
<groupId>org.jspecify</groupId>
99+
<artifactId>jspecify</artifactId>
100+
<version>${jspecify.version}</version>
101+
</dependency>
102+
103+
<dependency>
104+
<groupId>org.osgi</groupId>
105+
<artifactId>org.osgi.annotation.bundle</artifactId>
106+
<version>${osgi.bundle.version}</version>
107+
<scope>provided</scope>
108+
</dependency>
109+
110+
<dependency>
111+
<groupId>org.osgi</groupId>
112+
<artifactId>org.osgi.annotation.versioning</artifactId>
113+
<version>${osgi.versioning.version}</version>
114+
</dependency>
115+
116+
</dependencies>
117+
52118
</project>

pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
<module>parent</module>
6060

6161
<!-- Modules here must have a corresponding entry in `dependencyManagement > dependencies` block below! -->
62+
<module>jul-to-log4j-api</module>
6263

6364
</modules>
6465

@@ -97,7 +98,15 @@
9798
<!-- `dependencyManagement` must only contain `jdk` modules and nothing else!
9899
Modules here must have a corresponding entry in `modules` block above! -->
99100
<dependencyManagement>
100-
<dependencies />
101+
<dependencies>
102+
103+
<dependency>
104+
<groupId>org.apache.logging.log4j</groupId>
105+
<artifactId>jul-to-log4j-api</artifactId>
106+
<version>${project.version}</version>
107+
</dependency>
108+
109+
</dependencies>
101110
</dependencyManagement>
102111

103112
<build>

spotbugs-exclude.xml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<FindBugsFilter
19+
xmlns="https://github.com/spotbugs/filter/3.0.0"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
22+
<Match>
23+
<Not>
24+
<Bug category="SECURITY"/>
25+
</Not>
26+
<Rank value="9"/>
27+
</Match>
28+
<Match>
29+
<Or>
30+
<!-- Spotbugs `4.8.4.0` introducing `SING_SINGLETON_GETTER_NOT_SYNCHRONIZED` contains a regression[1], disabling it.
31+
[1] https://github.com/spotbugs/spotbugs/issues/2932 -->
32+
<Bug pattern="SING_SINGLETON_GETTER_NOT_SYNCHRONIZED"/>
33+
<!-- `SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR` check mostly generates noise, disabling it. -->
34+
<Bug pattern="SING_SINGLETON_HAS_NONPRIVATE_CONSTRUCTOR"/>
35+
</Or>
36+
</Match>
37+
</FindBugsFilter>

0 commit comments

Comments
 (0)