Skip to content

Commit 048c241

Browse files
committed
refactor(build): centralize auto-service version and configure annotation processor #11487
Before JDK 23, the annotation processor for Auto Service was picked up automatically. With newer JDKs, the META-INF/services files were not generated, which made it impossible for the PID Factories to be picked up by the ServiceLoader at runtime. Following the documentation, we seem to have missed adding the annotation processor to the Maven Build Plugin. Adding this missing bit re-enables the auto-generation on newer JDKs. See also: https://github.com/google/auto/blob/bb4d48e4ca0bda0e75b3b67f6ff4f464db9304e4/service/README.md
1 parent 28d288b commit 048c241

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

pom.xml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
<reload4j.version>1.2.18.4</reload4j.version>
3030
<flyway.version>10.19.0</flyway.version>
31+
<auto-service.version>1.1.1</auto-service.version>
3132
<jhove.version>1.20.1</jhove.version>
3233
<poi.version>5.4.0</poi.version>
3334
<tika.version>2.9.2</tika.version>
@@ -526,7 +527,7 @@
526527
<dependency>
527528
<groupId>com.google.auto.service</groupId>
528529
<artifactId>auto-service</artifactId>
529-
<version>1.1.1</version>
530+
<version>${auto-service.version}</version>
530531
<optional>true</optional>
531532
<type>jar</type>
532533
</dependency>
@@ -831,6 +832,14 @@
831832
<release>${target.java.version}</release>
832833
<!-- for use with `mvn -DcompilerArgument=-Xlint:unchecked compile` -->
833834
<compilerArgument>${compilerArgument}</compilerArgument>
835+
<!-- Ensure the annotation processor for @AutoService is picked up. Especially important as of JDK 23 -->
836+
<annotationProcessorPaths>
837+
<path>
838+
<groupId>com.google.auto.service</groupId>
839+
<artifactId>auto-service</artifactId>
840+
<version>${auto-service.version}</version>
841+
</path>
842+
</annotationProcessorPaths>
834843
</configuration>
835844
</plugin>
836845
<plugin>

0 commit comments

Comments
 (0)