Skip to content

Trying to implement #1380: remove use of Moditect plug-in for 3.0 #1381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jan 10, 2025
Merged
55 changes: 44 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,32 @@ tools.jackson.core.*;version=${project.version}
<groupId>com.google.code.maven-replacer-plugin</groupId>
<artifactId>replacer</artifactId>
</plugin>

<!-- 04-Mar-2019, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
will have to use `moduleInfoFile` as anything else requires JDK 9+
<!-- 10-Jan-2025, tatu: [core#1380] Still need to use Moditect to
work around bug/misfeature of maven-shade-plugin where it absolutely
removes root-level `module-info.class`. So use Moditect to put it back
(but from diff place than with Jackson 2.x)
-->
<plugin>
<groupId>org.moditect</groupId>
<artifactId>moditect-maven-plugin</artifactId>
<executions>
<execution>
<id>add-module-infos</id>
<phase>package</phase>
<goals>
<goal>add-module-info</goal>
</goals>
<configuration>
<overwriteExistingFiles>true</overwriteExistingFiles>
<module>
<moduleInfoFile>src/main/java/module-info.java</moduleInfoFile>
</module>
</configuration>
</execution>
</executions>
<configuration>
<jvmVersion>17</jvmVersion>
</configuration>
</plugin>
<!-- 03-Nov-2020, tatu: Add LICENSE from main level -->
<plugin>
Expand All @@ -139,6 +158,9 @@ tools.jackson.core.*;version=${project.version}
</goals>
<configuration>
<filters>
<!-- Need to filter out FDP module-infos, don't need JDK11
versions (min JDK 17+).
-->
<filter>
<artifact>ch.randelshofer:fastdoubleparser</artifact>
<excludes>
Expand All @@ -155,7 +177,10 @@ tools.jackson.core.*;version=${project.version}
NOTE: `project.version.underscore' comes from `jackson-base/pom.xml`
parent pom
-->
<shadedPattern>tools/jackson/core/internal/shaded/fdp/v${project.version.underscore}</shadedPattern>
<!-- 10-Jan-2025, tatu: while good idea pre-Modules (to break access),
won't mix well with JPMS. So let's not.
-->
<shadedPattern>tools/jackson/core/internal/shaded/fdp</shadedPattern>
</relocation>
<relocation>
<pattern>META-INF/LICENSE</pattern>
Expand All @@ -175,15 +200,15 @@ tools.jackson.core.*;version=${project.version}
</relocation>
<relocation>
<pattern>META-INF/versions/17/ch/randelshofer/fastdoubleparser</pattern>
<shadedPattern>META-INF/versions/17/tools/jackson/core/internal/shaded/fdp/v${project.version.underscore}</shadedPattern>
<shadedPattern>META-INF/versions/17/tools/jackson/core/internal/shaded/fdp</shadedPattern>
</relocation>
<relocation>
<pattern>META-INF/versions/21/ch/randelshofer/fastdoubleparser</pattern>
<shadedPattern>META-INF/versions/21/tools/jackson/core/internal/shaded/fdp/v${project.version.underscore}</shadedPattern>
<shadedPattern>META-INF/versions/21/tools/jackson/core/internal/shaded/fdp</shadedPattern>
</relocation>
<relocation>
<pattern>META-INF/versions/22/ch/randelshofer/fastdoubleparser</pattern>
<shadedPattern>META-INF/versions/22/tools/jackson/core/internal/shaded/fdp/v${project.version.underscore}</shadedPattern>
<shadedPattern>META-INF/versions/22/tools/jackson/core/internal/shaded/fdp</shadedPattern>
</relocation>
</relocations>
</configuration>
Expand All @@ -193,10 +218,10 @@ tools.jackson.core.*;version=${project.version}
<plugin>
<groupId>de.jjohannes</groupId>
<artifactId>gradle-module-metadata-maven-plugin</artifactId>
<!-- 27-Apr-2023, tatu: [core#999]: Need to exclude shaded FDP
dependency from GMM
-->
<configuration>
<!-- 27-Apr-2023, tatu: [core#999]: Need to exclude shaded FDP
dependency from GMM
-->
<configuration>
<removedDependencies>
<dependency>
<groupId>ch.randelshofer</groupId>
Expand All @@ -214,6 +239,14 @@ tools.jackson.core.*;version=${project.version}
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
<!-- 10-Jan-2025, tatu: [core#1380] Kludgerus Maximums... must actually
remove `module-info.class` just so Moditect can add it in place
where shade plugin will not filter it out. Oy vey.
-->
<excludes>
<exclude>module-info.class</exclude>
</excludes>

</configuration>
</plugin>

Expand Down
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ JSON library.
allocation default implementation (in 3.0)
#1364: JSTEP-6: rename `JsonLocation` as `TokenStreamLocation`
#1378: Rename `JsonParser.getText()` as `.getString()` [JSTEP-6]
#1380: Change 3.0 to use `module-info.java` directly, remove use of Moditect
- Rename `JsonGenerator.Feature.AUTO_CLOSE_JSON_CONTENT` as `AUTO_CLOSE_CONTENT`
- Add `TreeCodec.nullNode()`, `TreeNode.isNull()` methods
- Change the way `JsonLocation.NA` is included in exception messages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// jackson-core main Module descriptor
module tools.jackson.core {
// FastDoubleParser shaded but JPMS still requires it to compile?
requires static ch.randelshofer.fastdoubleparser;

exports tools.jackson.core;
exports tools.jackson.core.async;
exports tools.jackson.core.base;
Expand Down
41 changes: 41 additions & 0 deletions src/test/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// jackson-core test Module descriptor: contains most if not all main
// plus some test dependencies
module tools.jackson.core {
// Additional test lib/framework dependencies
requires org.assertj.core;
requires org.junit.jupiter.api;
requires org.junit.jupiter.params;

// FastDoubleParser shaded but JPMS still requires it to compile?
requires static ch.randelshofer.fastdoubleparser;

// Main exports need to switch to "opens" for testing
opens tools.jackson.core;
opens tools.jackson.core.async;
opens tools.jackson.core.base;
opens tools.jackson.core.exc;
opens tools.jackson.core.filter;
opens tools.jackson.core.io;
opens tools.jackson.core.json;
opens tools.jackson.core.json.async;
opens tools.jackson.core.sym;
opens tools.jackson.core.tree;
opens tools.jackson.core.type;
opens tools.jackson.core.util;

// Additional test opens (not exported by main)

opens tools.jackson.core.base64;
opens tools.jackson.core.constraints;
opens tools.jackson.core.dos;
opens tools.jackson.core.fuzz;
opens tools.jackson.core.io.schubfach;
opens tools.jackson.core.jsonptr;
opens tools.jackson.core.read;
opens tools.jackson.core.read.loc;
opens tools.jackson.core.testutil.failure;
opens tools.jackson.core.tofix;
opens tools.jackson.core.tofix.async;
opens tools.jackson.core.write;

}