Skip to content

Generate module-info, fix build on JDK11+#324

Merged
stevehu merged 2 commits intonetworknt:masterfrom
handcraftedbits:master
Sep 21, 2020
Merged

Generate module-info, fix build on JDK11+#324
stevehu merged 2 commits intonetworknt:masterfrom
handcraftedbits:master

Conversation

@handcraftedbits
Copy link
Copy Markdown
Contributor

@handcraftedbits handcraftedbits commented Sep 16, 2020

This PR makes json-schema-validator work better with JDK9+ w.r.t. modularization and a couple build fixes for JDK11+:

  • commons-lang is bumped from 3.5 to 3.7 so the generated module-info can point to a fixed module name (instead of using an "automatic module name" determined from the JAR's filename, which is a discouraged practice). slf4j-api was not bumped because the next version with any module support is 2.0.0-alpha1, which I figured was too drastic of a version bump.
  • moditect-maven-plugin is added to build a module-info.class class file which serves as the module descriptor. This works even during a JDK8 build because moditect-maven-plugin will generate the .class file itself and place it under META-INF/versions/9, making this a multi-release JAR. JDK8 will ignore module-info at runtime and JDK9+ will make use of it.
  • maven-javadoc-plugin and jacoco-maven-plugin had their versions bumped to support JDK11+.

Edit: when I said JDK8, that's the lowest version I tested on. I just noticed that JDK6 is the default build target for this project... I believe this should still work fine with the multi-release JAR trick.

@stevehu
Copy link
Copy Markdown
Contributor

stevehu commented Sep 16, 2020

@handcraftedbits I don't see any problem with the update; however, I want to test on the Java 6 build on your repo to ensure that it is backward compatible. We still have a lot of users stuck with early version of Andriod and we have to support them. BTW, are you building the library on your own? What is your use case to support Java 11 build? Thanks a lot for your help.

@handcraftedbits
Copy link
Copy Markdown
Contributor Author

Yes, I'm building it for my own standalone project that uses JDK9+. Thanks!

@handcraftedbits
Copy link
Copy Markdown
Contributor Author

FYI, I had one more change. I bumped slf4j-api up to 1.7.30 because it looks like they did indeed add a fixed automatic name for their module in that version. Also, I made the Jackson module requirement transitive.

@stevehu stevehu merged commit dddd660 into networknt:master Sep 21, 2020
@stevehu
Copy link
Copy Markdown
Contributor

stevehu commented Oct 20, 2020

@handcraftedbits While building the release on jdk8, I got the following error. Meanwhile, I have to remove the plugin manually to release it. Could you please take a look at it? Thanks.

To reproduce it.

mvn clean install deploy

@stevehu
Copy link
Copy Markdown
Contributor

stevehu commented Oct 20, 2020

#338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants