Skip to content

Commit 6502f3c

Browse files
committed
Manual pom.xml merge from #1562
1 parent 8e7392e commit 6502f3c

File tree

1 file changed

+34
-30
lines changed

1 file changed

+34
-30
lines changed

pom.xml

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -184,33 +184,6 @@ tools.jackson.core.*;version=${project.version}
184184
<artifactId>cyclonedx-maven-plugin</artifactId>
185185
</plugin>
186186

187-
<!-- 10-Jan-2025, tatu: [core#1380] Still need to use Moditect to
188-
work around bug/misfeature of maven-shade-plugin where it absolutely
189-
removes root-level `module-info.class`. So use Moditect to put it back
190-
(but from diff place than with Jackson 2.x)
191-
-->
192-
<plugin>
193-
<groupId>org.moditect</groupId>
194-
<artifactId>moditect-maven-plugin</artifactId>
195-
<executions>
196-
<execution>
197-
<id>add-module-infos</id>
198-
<phase>package</phase>
199-
<goals>
200-
<goal>add-module-info</goal>
201-
</goals>
202-
<configuration>
203-
<overwriteExistingFiles>true</overwriteExistingFiles>
204-
<module>
205-
<moduleInfoFile>src/main/java/module-info.java</moduleInfoFile>
206-
</module>
207-
</configuration>
208-
</execution>
209-
</executions>
210-
<configuration>
211-
<jvmVersion>17</jvmVersion>
212-
</configuration>
213-
</plugin>
214187
<!-- 03-Nov-2020, tatu: Add LICENSE from main level -->
215188
<plugin>
216189
<groupId>org.codehaus.mojo</groupId>
@@ -305,6 +278,36 @@ tools.jackson.core.*;version=${project.version}
305278
</execution>
306279
</executions>
307280
</plugin>
281+
<!-- 10-Jan-2025, tatu: [core#1380] Use Moditect to add `module-info.class`
282+
at JAR root level. Must run AFTER shade plugin (declared after it here
283+
so Maven executes it later in `package` phase) so shade cannot strip it.
284+
Override parent's jvmVersion=17 via combine.self="override" so that
285+
module-info.class is placed at root `/` rather than META-INF/versions/17/.
286+
-->
287+
<plugin>
288+
<groupId>org.moditect</groupId>
289+
<artifactId>moditect-maven-plugin</artifactId>
290+
<executions>
291+
<execution>
292+
<id>add-module-infos</id>
293+
<phase>package</phase>
294+
<goals>
295+
<goal>add-module-info</goal>
296+
</goals>
297+
<configuration>
298+
<overwriteExistingFiles>true</overwriteExistingFiles>
299+
<module>
300+
<moduleInfoFile>src/main/java/module-info.java</moduleInfoFile>
301+
</module>
302+
</configuration>
303+
</execution>
304+
</executions>
305+
<!-- Override parent's jvmVersion=17: no jvmVersion means module-info.class
306+
is placed at JAR root instead of META-INF/versions/17/
307+
-->
308+
<configuration combine.self="override">
309+
</configuration>
310+
</plugin>
308311
<plugin>
309312
<groupId>org.gradlex</groupId>
310313
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
@@ -329,9 +332,10 @@ tools.jackson.core.*;version=${project.version}
329332
<Multi-Release>true</Multi-Release>
330333
</manifestEntries>
331334
</archive>
332-
<!-- 10-Jan-2025, tatu: [core#1380] Kludgerus Maximums... must actually
333-
remove `module-info.class` just so Moditect can add it in place
334-
where shade plugin will not filter it out. Oy vey.
335+
<!-- 10-Jan-2025, tatu: [core#1380] Exclude module-info.class from
336+
initial jar so that shade plugin never sees it (shade strips
337+
root-level module-info.class). Moditect re-adds it at root
338+
after shade runs (see moditect plugin declaration below shade).
335339
-->
336340
<excludes>
337341
<exclude>module-info.class</exclude>

0 commit comments

Comments
 (0)