Java fails because groovy modules are exporting the same package to another module

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Java fails because groovy modules are exporting the same package to another module

Warren Milburn

I have a multi-module project that uses maven as its build system.  I’m using Adopt OpenJDK 11.0.7 with Groovy 3.0.4 and building with Maven 3.6.3.  The other suspect in this case is the module xml.resolver which is version 1.2.

 

After much coaxing and cajoling, the project builds but when I try to run it up, it gives this error:

 

Error occurred during initialization of boot layer

java.lang.module.ResolutionException: Modules org.codehaus.groovy.test and org.codehaus.groovy.xml export package groovy.util to module xml.resolver

 

 

Has anyone come across this yet?  Or have any clues as to how I can resolve it?

 

Reply | Threaded
Open this post in threaded view
|

Re: Java fails because groovy modules are exporting the same package to another module

paulk_asert
Administrator
TL;DR version: Groovy 3 doesn't support using the multiple Groovy jars as automatic modules. I'd recommend placing them on the classpath.

More details:
Groovy prior to 3 had numerous jars with classes having common package names, e.g. "groovy.util". Groovy 3 has repackaged all such offending classes but retained deprecated original packages for backwards compatibility. If you only use the newer versions of those classes, you could do extra work to explicitly declare modules and export only the non-offending packages but we don't currently do that for you. Groovy 4 has only the new package names and so will be module friendly out of the box but no longer backwards compatible.

Cheers, Paul.


On Mon, Jun 29, 2020 at 6:13 PM Warren Milburn <[hidden email]> wrote:

I have a multi-module project that uses maven as its build system.  I’m using Adopt OpenJDK 11.0.7 with Groovy 3.0.4 and building with Maven 3.6.3.  The other suspect in this case is the module xml.resolver which is version 1.2.

 

After much coaxing and cajoling, the project builds but when I try to run it up, it gives this error:

 

Error occurred during initialization of boot layer

java.lang.module.ResolutionException: Modules org.codehaus.groovy.test and org.codehaus.groovy.xml export package groovy.util to module xml.resolver

 

 

Has anyone come across this yet?  Or have any clues as to how I can resolve it?

 

Reply | Threaded
Open this post in threaded view
|

Re: Java fails because groovy modules are exporting the same package to another module

Warren Milburn
Thanks Paul for your explanation.  I now have my project working.

Kind regards, Warren Milburn

On 1 Jul 2020 06:20, Paul King <[hidden email]> wrote:
TL;DR version: Groovy 3 doesn't support using the multiple Groovy jars as automatic modules. I'd recommend placing them on the classpath.

More details:
Groovy prior to 3 had numerous jars with classes having common package names, e.g. "groovy.util". Groovy 3 has repackaged all such offending classes but retained deprecated original packages for backwards compatibility. If you only use the newer versions of those classes, you could do extra work to explicitly declare modules and export only the non-offending packages but we don't currently do that for you. Groovy 4 has only the new package names and so will be module friendly out of the box but no longer backwards compatible.

Cheers, Paul.


On Mon, Jun 29, 2020 at 6:13 PM Warren Milburn <[hidden email]> wrote:

I have a multi-module project that uses maven as its build system.  I’m using Adopt OpenJDK 11.0.7 with Groovy 3.0.4 and building with Maven 3.6.3.  The other suspect in this case is the module xml.resolver which is version 1.2.

 

After much coaxing and cajoling, the project builds but when I try to run it up, it gives this error:

 

Error occurred during initialization of boot layer

java.lang.module.ResolutionException: Modules org.codehaus.groovy.test and org.codehaus.groovy.xml export package groovy.util to module xml.resolver

 

 

Has anyone come across this yet?  Or have any clues as to how I can resolve it?