I'm having trouble getting a Maven Eclipse project to build in both Maven and Eclipse. The problem appears to be that the JSON validation library com.networknt wants to be required (in module-info.java) as requires com.networknt.schema in Maven, but as requires json.schema.validator in Eclipse (as Maven project). Each build simply cannot see the module if it is named the other way. I can build in Eclipse if I "run as maven build..." but that doesnt help coding or JUnit test debug etc.
I have the following in my pom:
<dependency>
<groupId>com.networknt</groupId>
<artifactId>json-schema-validator</artifactId>
<version>1.4.3</version>
</dependency>
I'm using 1.4.3 from https://mvnrepository.com/artifact/com.networknt/json-schema-validator
Anyone know what's up here?
The json-schema-validator-1.4.3.jar
is a multi-release JAR file with the module-info.class
not included in the root of the JAR, but as META-INF/versions/9/module-info.class
. The module-info.class
file is compiled with Java 9 and the rest with Java 8. This way it can be used with Java 8, but also as a modular JAR with Java 9 and higher.
Eclipse seems not to support this yet: Eclipse JDT core issue #2495: Multi-Release JAR is not recognized as such
As a workaround, do one of the following:
json-schema-validator-1.4.3.jar
copy module-info.class
from META-INF/versions/9/
to the rootMETA-INF/MANIFEST.MF
add the line Automatic-Module-Name: com.networknt.schema