Skip to content

Commit ae8af12

Browse files
committed
Add transitive compileOnlyApi (requires static) dependencies
See #3437 for details. Signed-off-by: Jendrik Johannes <[email protected]>
1 parent 5aac7d6 commit ae8af12

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

log4j-parent/pom.xml

+56
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,15 @@
154154
<httpcore.version>4.4.16</httpcore.version>
155155
<jna.version>5.16.0</jna.version>
156156

157+
<!-- Add 'requires static' for annotation library dependencies (defined as <scope>provided</scope> in this file)
158+
to allow them to be visible at compile time to make the '-Xlint:classfile' check of javac pass.
159+
Overrides parent's 'bnd-jpms-module-info' and hence re-defines '$[bnd-module-name];access=0' -->
160+
<bnd-jpms-module-info>$[bnd-module-name];access=0;modules="
161+
biz.aQute.bnd.annotation,
162+
com.google.errorprone.annotations,
163+
com.github.spotbugs.annotations,
164+
org.osgi.annotation.bundle
165+
"</bnd-jpms-module-info>
157166
</properties>
158167

159168
<dependencyManagement>
@@ -1088,6 +1097,53 @@
10881097
</executions>
10891098
</plugin>
10901099

1100+
<!-- Add annotation library dependencies (defined as <scope>provided</scope> in this file) as compileOnlyApi
1101+
dependencies for Gradle consumers. This makes the Jars automatically available at compile time to make
1102+
the '-Xlint:classfile' check of javac pass.-->
1103+
<plugin>
1104+
<groupId>org.gradlex</groupId>
1105+
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
1106+
<version>1.0</version>
1107+
<configuration>
1108+
<compileOnlyApiDependencies>
1109+
<dependency>
1110+
<groupId>org.jspecify</groupId>
1111+
<artifactId>jspecify</artifactId>
1112+
<version>${jspecify.version}</version>
1113+
</dependency>
1114+
<dependency>
1115+
<groupId>biz.aQute.bnd</groupId>
1116+
<artifactId>biz.aQute.bnd.annotation</artifactId>
1117+
<version>${bnd.annotation.version}</version>
1118+
</dependency>
1119+
<dependency>
1120+
<groupId>com.google.errorprone</groupId>
1121+
<artifactId>error_prone_annotations</artifactId>
1122+
<version>${error-prone.version}</version>
1123+
</dependency>
1124+
<dependency>
1125+
<groupId>org.osgi</groupId>
1126+
<!-- Note: 'org.osgi.annotation.bundle' and 'osgi.annotation' overlap. We do not want to add
1127+
both. As 'org.osgi.annotation.bundle' has an Automatic-Module-Name, it is preferred. -->
1128+
<artifactId>org.osgi.annotation.bundle</artifactId>
1129+
<version>${osgi.annotation.bundle.version}</version>
1130+
</dependency>
1131+
<dependency>
1132+
<groupId>com.github.spotbugs</groupId>
1133+
<artifactId>spotbugs-annotations</artifactId>
1134+
<version>${spotbugs-annotations.version}</version>
1135+
</dependency>
1136+
</compileOnlyApiDependencies>
1137+
</configuration>
1138+
<executions>
1139+
<execution>
1140+
<goals>
1141+
<goal>gmm</goal>
1142+
</goals>
1143+
</execution>
1144+
</executions>
1145+
</plugin>
1146+
10911147
</plugins>
10921148
</build>
10931149

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="https://logging.apache.org/xml/ns"
4+
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
5+
type="fixed">
6+
<issue id="3437" link="https://github.com/apache/logging-log4j2/issues/3437"/>
7+
<description format="asciidoc">
8+
Make annotation libraries visible transitively at compile time for Gradle users through Gradle Module Metadata
9+
and for JPMS users through 'requires static' directives in module-info files.
10+
</description>
11+
</entry>

0 commit comments

Comments
 (0)