Seeking Assurance That Patching gradle-api-6.{...}.jar Is At Least Technically Possible - Somehow

Plugins plugins at lingocoder.com
Tue Nov 12 02:30:50 UTC 2019


Hi all,

I might have spoken too soon in my last October email [1]. Ever since,
I've 
been having a hell of a time trying to get Gradle's so-called
„shaded“ API jar 
to play nicely with the other modules in my JPMS-build-enabling Gradle
plugin [2]

For some reason, Gradle's generated artifact redundantly duplicates all
the
packages of two modules from the JDK: javax.xml and jdk.xml.dom. 

Any other modules in the module path that read packages in either of
those two system
modules breaks the JPMS with your classic split package error:

----
$ java -ea src\eg\UnPatchable.java

Exception in thread "main" java.lang.module.ResolutionException: 
Modules gradle.api and java.xml export package javax.xml.transform to
module
 com.github.javaparser.symbolsolver.core
        at
java.base/java.lang.module.Resolver.resolveFail(Resolver.java:885)
        at
java.base/java.lang.module.Resolver.failTwoSuppliers(Resolver.java:797)
        at
java.base/java.lang.module.Resolver.checkExportSuppliers(Resolver.java:718)
        at java.base/java.lang.module.Resolver.finish(Resolver.java:362)
        at
java.base/java.lang.module.Configuration.<init>(Configuration.java:141)
        at
java.base/java.lang.module.Configuration.resolve(Configuration.java:424)
        at
java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
        at eg.UnPatchable.main(UnPatchable.java:21)

----

Or the same failure but with a different message:

----
$ java -ea --module-path lib src\eg\UnPatchable.java

Error occurred during initialization of boot layer
 java.lang.module.ResolutionException: Module gradle.api contains
package 
 org.xml.sax, module java.xml exports package org.xml.sax to gradle.api
----

What the subject of this email is about, is that even attempting to 
patch the Gradle API jar does not fix the split package problem:

----
$ java -ea --module-path lib --add-modules ALL-MODULE-PATH \ 
 --patch-module java.xml=lib\gradle-api-6.0-rc-2.jar \
 --patch-module jdk.xml.dom=lib\gradle-api-6.0-rc-2.jar; \ 
 --patch-module gradle.api=com.github.javaparser.symbolsolver.core
src\eg\UnPatchable.java

Error occurred during initialization of boot layer
 java.lang.module.ResolutionException: Modules gradle.api and java.xml
export
 package javax.xml.validation to module
com.github.javaparser.symbolsolver.core
----

Those errors are reproducible with these steps:

1. Download, unzip and cd into the attached example project [3]
2. From a terminal, enter the commands I entered in the snippets above

I'm hoping that it's not as bad as I think it is. Hopefully, it's 
nothing worse than I just haven't learned what the right command is to
fix this. 

Please, can jigsaw-dev shed some light on this so far intractable
problem? TIA.

----
[1] http://bit.ly/014298
[2] http://bit.ly/mrJar
[3] http://bit.ly/014309zip




More information about the jigsaw-dev mailing list