jruby-maven-plugins icon indicating copy to clipboard operation
jruby-maven-plugins copied to clipboard

LayerInstantiationException with java 9+ and multi-modules

Open seanstory opened this issue 3 years ago • 0 comments

In Java 9+, we got Java Modules. It's required that each Java Module have a unique set of packages.

The gem-maven-plugin packages gemspecs in a specifications/ directory in your jars. This leads to errors like:

[ERROR] Error occurred during initialization of boot layer
[DEBUG] Error occurred during initialization of boot layer
[DEBUG] java.lang.LayerInstantiationException: Package specifications in both module example.provider and module example.consumer
[DEBUG] Closing the fork 1 after not saying Good Bye.

Related Stack Overflow post: https://stackoverflow.com/questions/53640794/java-modules-and-resources-in-identical-directories

The only workaround I've found for this is to mark the rubygems dependencies as <scope>provided</scope> to avoid having them packaged inside my resulting jars. But this is non-ideal.

seanstory avatar Feb 15 '22 22:02 seanstory