Skip to content

Commit

Permalink
Add simple module-info for JDK9+, using Moditect
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 5, 2019
1 parent 11a4ed6 commit 48d5153
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 6 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: java
# 08-Dec-2018, tatu: While it should be possible to run core streaming on Java 6,
# build won't work with anything below Java 8 now
- openjdk8
- oraclejdk11

# Below this line is configuration for deploying to the Sonatype OSS repo
# http://blog.xeiam.com/2013/05/configure-travis-ci-to-deploy-snapshots.html
Expand Down
37 changes: 31 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@
</scm>

<properties>
<!-- 16-Sep-2016, tatu: Retain Java6/JDK1.6 compatibility for streaming for Jackson 2.x -->
<!-- 04-Mar-2019, tatu: Retain Java6/JDK1.6 compatibility for annotations for Jackson 2.x,
but use Moditect to get JDK9+ module info support; need newer bundle plugin as well
-->
<javac.src.version>1.6</javac.src.version>
<javac.target.version>1.6</javac.target.version>

<!-- 04-May-2016, tatu: Bundle-plugin 3.x seems to require Java 7, so to
build for Java 6 need to downgrade here to last working 2.x version
(2.5.4 had some issues wrt shading)
-->
<version.plugin.bundle>2.5.3</version.plugin.bundle>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>

<version.plugin.bundle>3.2.0</version.plugin.bundle>

<osgi.export>com.fasterxml.jackson.core;version=${project.version},
com.fasterxml.jackson.core.*;version=${project.version}
Expand Down Expand Up @@ -95,6 +96,30 @@ com.fasterxml.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` which is crappy but anything else requires
JDK 9+. With Jackson 3.0 will upgrade.
-->
<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/moditect/module-info.java</moduleInfoFile>
</module>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
18 changes: 18 additions & 0 deletions src/moditect/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module com.fasterxml.jackson.core {
// 04-Mar-2019, tatu: Ugh. Can not use wildcards, stupid ass JDK 9+ module system...
// So, for 2.x core need to make sure we manually include everything.
// Worse, there is only syntactic validation, not contents, so we can both miss
// AND add bogus packages.
exports com.fasterxml.jackson.core;
exports com.fasterxml.jackson.core.async;
exports com.fasterxml.jackson.core.base;
exports com.fasterxml.jackson.core.exc;
exports com.fasterxml.jackson.core.filter;
exports com.fasterxml.jackson.core.format;
exports com.fasterxml.jackson.core.io;
exports com.fasterxml.jackson.core.json;
exports com.fasterxml.jackson.core.json.async;
exports com.fasterxml.jackson.core.sym;
exports com.fasterxml.jackson.core.type;
exports com.fasterxml.jackson.core.util;
}

0 comments on commit 48d5153

Please sign in to comment.