extra-java-module-info icon indicating copy to clipboard operation
extra-java-module-info copied to clipboard

[Maybe] Add removePackage feature to deal with split-packages in JDK Modules (for example xerces:xercesImpl)

Open wardeneta opened this issue 1 year ago • 1 comments

Hello, I tried your plugin and there was a problem with this library

implementation 'xerces:xercesImpl:2.12.2'

which contains the package org.w3c.dom, which is part of jdk.xml.dom. how to solve it in this case? Thanks

wardeneta avatar Sep 14 '24 10:09 wardeneta

Hi, I am afraid this can't be solved with the plugin right now.

As you have a conflict with a Module in the JDK itself – jdk.xml.dom – you can't use the mergeJar functionality, as you cannot modify a Module of the JDK itself.

I think this should really be solved in xerces. It is this issue: https://issues.apache.org/jira/browse/XERCESJ-1689

Looks like it was fixed months ago, but never released. 😞


We could think about adding a new functionality to this plugin that allows you to completely remove a package from a Jar. As we already do filtering of Jar entries and allow to ignore service providers:

extraJavaModuleInfo {               
    module("groovy-all-2.4.15.jar", "groovy.all", "2.4.15") {
       ignoreServiceProvider("org.codehaus.groovy.source.Extensions")
    }
}

We could add something similar to remove a package:

extraJavaModuleInfo {               
    module("xerces:xercesImpl", "xerces.impl)") {
       removePackage("org.w3c.dom.html") // THIS IS A MOCKUP, we do not have this yet
    }
}

I am would be open for contributions.

jjohannes avatar Sep 21 '24 10:09 jjohannes

The feature I sketched above is available in 1.10 – would be happy to hear your feedback @wardeneta.

jjohannes avatar Feb 03 '25 11:02 jjohannes