From 4cfe7b95ef2c6c37665a5ebf751ea1536c430ef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Troels=20N=C3=B8rgaard?= Date: Wed, 4 Mar 2020 23:21:57 +0100 Subject: [PATCH] Automatic module names for Java 9+ modules 'assert' is a reserved keyword in Java and indeed also in module-info.java (Java module system), therefore the automatic jar-to-module convert fails and when using the library with a Java module, the compiler can not find the classes, as the module name errors. This added the standardized attribute in the manifest for naming the module, and does not modularize the code as such. It does allow the library to be used from Java 9+ modules. There should be no effect on Java 8 and below. --- json-path-assert/build.gradle | 2 +- json-path-web-test/build.gradle | 3 ++- json-path/build.gradle | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/json-path-assert/build.gradle b/json-path-assert/build.gradle index f63e70bb..cd9f0a44 100644 --- a/json-path-assert/build.gradle +++ b/json-path-assert/build.gradle @@ -5,7 +5,7 @@ description = "Assertions on Json using JsonPath" jar { baseName 'json-path-assert' manifest { - attributes 'Implementation-Title': 'json-path-assert', 'Implementation-Version': version + attributes 'Implementation-Title': 'json-path-assert', 'Implementation-Version': version, 'Automatic-Module-Name': 'jayway.jsonpath.pathassert' } } diff --git a/json-path-web-test/build.gradle b/json-path-web-test/build.gradle index 4f3713c7..cfaffe95 100644 --- a/json-path-web-test/build.gradle +++ b/json-path-web-test/build.gradle @@ -21,7 +21,8 @@ jar { manifest { attributes 'Implementation-Title': 'json-path-web-test', 'Implementation-Version': version, - 'Main-Class': mainClassName + 'Main-Class': mainClassName, + 'Automatic-Module-Name': 'jayway.jsonpath.webtest' } } diff --git a/json-path/build.gradle b/json-path/build.gradle index 812eac64..6e0e9986 100644 --- a/json-path/build.gradle +++ b/json-path/build.gradle @@ -5,7 +5,7 @@ description = "Java port of Stefan Goessner JsonPath." jar { baseName 'json-path' manifest { - attributes 'Implementation-Title': 'json-path', 'Implementation-Version': version + attributes 'Implementation-Title': 'json-path', 'Implementation-Version': version, 'Automatic-Module-Name': 'jayway.jsonpath.path' instruction 'Import-Package', 'org.json.*;resolution:=optional', 'com.google.gson.*;resolution:=optional', 'com.fasterxml.jackson.*;resolution:=optional', 'org.apache.tapestry5.json.*;resolution:=optional', 'org.codehaus.jettison.*;resolution:=optional', '*' } }