Skip to content

Commit b22d303

Browse files
committed
fix(build): keep the automatic module name in the released jar
1 parent 7f65347 commit b22d303

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

‎pom.xml‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@
104104

105105
<packaging>jar</packaging>
106106

107+
<!-- activating any profile switches off the activeByDefault "default" one, so config that every build needs belongs here rather than in a profile that "mvn deploy -P release" turns off -->
108+
<build>
109+
<plugins>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-jar-plugin</artifactId>
113+
<version>3.5.1</version>
114+
<configuration>
115+
<archive>
116+
<manifestEntries>
117+
<!-- JPMS consumers "requires se.michaelthelin.spotify"; without this the name is derived from the file name instead and their module graph breaks -->
118+
<Automatic-Module-Name>se.michaelthelin.spotify</Automatic-Module-Name>
119+
</manifestEntries>
120+
</archive>
121+
</configuration>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
107126
<profiles>
108127
<profile>
109128
<id>default</id>
@@ -163,18 +182,6 @@
163182
<artifactId>maven-surefire-plugin</artifactId>
164183
<version>3.5.6</version>
165184
</plugin>
166-
<plugin>
167-
<groupId>org.apache.maven.plugins</groupId>
168-
<artifactId>maven-jar-plugin</artifactId>
169-
<version>3.5.1</version>
170-
<configuration>
171-
<archive>
172-
<manifestEntries>
173-
<Automatic-Module-Name>se.michaelthelin.spotify</Automatic-Module-Name>
174-
</manifestEntries>
175-
</archive>
176-
</configuration>
177-
</plugin>
178185
</plugins>
179186
</build>
180187
</profile>
@@ -199,6 +206,8 @@
199206
<!-- accessors and builder setters in model_objects carry no prose of their own,
200207
so only broken syntax and dead references should be reported -->
201208
<doclint>all,-missing</doclint>
209+
<!-- the jar carries an Automatic-Module-Name, which is enough for javadoc to switch to the modular layout; the published pages live at package paths, so keep generating them there -->
210+
<legacyMode>true</legacyMode>
202211
</configuration>
203212
</plugin>
204213
</plugins>
@@ -262,6 +271,8 @@
262271
</executions>
263272
<configuration>
264273
<doclint>all,-missing</doclint>
274+
<!-- see the javadoc-check profile: an Automatic-Module-Name alone flips javadoc to the modular layout and would move every published page -->
275+
<legacyMode>true</legacyMode>
265276
<outputDirectory>${project.basedir}/</outputDirectory>
266277
</configuration>
267278
</plugin>

0 commit comments

Comments
 (0)