Skip to content

Commit 8c59df1

Browse files
committed
build: add JPMS Automatic-Module-Name to JAR manifest
Configure the maven-jar-plugin to add an Automatic-Module-Name entry (org.locationtech.proj4j.geoapi) to the JAR manifest. This provides a stable and explicit JPMS module name for consumers using the Java module system, instead of relying on the automatically derived name based on the JAR file name. It also improves Gradle JPMS support: Gradle only puts dependencies on the module path if they either contain a module-info.class or declare an Automatic-Module-Name. Without this entry, this artifact is always kept on the classpath in modular Gradle builds and cannot be required by name from module-info.java. Signed-off-by: Jiri Peinlich <jiri.peinlich@gmail.com>
1 parent 3a5a269 commit 8c59df1

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

geoapi/pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@
7373
<excludePackageNames>org.locationtech.proj4j.geoapi.spi</excludePackageNames>
7474
</configuration>
7575
</plugin>
76+
77+
<plugin>
78+
<artifactId>maven-jar-plugin</artifactId>
79+
<configuration>
80+
<archive>
81+
<manifestEntries>
82+
<Automatic-Module-Name>org.locationtech.proj4j.geoapi</Automatic-Module-Name>
83+
</manifestEntries>
84+
</archive>
85+
</configuration>
86+
</plugin>
87+
7688
</plugins>
7789
</build>
7890

pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@
111111
<artifactId>maven-surefire-plugin</artifactId>
112112
<version>3.1.0</version>
113113
</plugin>
114+
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
116+
<artifactId>maven-jar-plugin</artifactId>
117+
<version>3.4.1</version>
118+
</plugin>
114119

115120
<!-- Maven Central Publish -->
116121
<plugin>

0 commit comments

Comments
 (0)