Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

maven-bundle-plugin fails with "Invalid class file module-info.class"

After adding a dependency that contains a JPMS module, the maven-bundle-plugin (version 3.3.0) fails with:

[INFO] --- maven-bundle-plugin:3.3.0:bundle (default-bundle) @ my-bundle ---
[ERROR] Bundle myGroup:my-bundle:bundle:1.0 : 
        Exception: java.lang.ArrayIndexOutOfBoundsException: 19
[ERROR] Bundle myGroup:my-bundle:bundle:1.0 : 
        Invalid class file module-info.class (java.lang.ArrayIndexOutOfBoundsException: 19)

It seems that the plugin tries (and fails) to analyze the module-info.class, which should be irrelevant in an OSGi context.

like image 330
gjoranv Avatar asked May 25 '18 14:05

gjoranv


1 Answers

Upgrading the bundle plugin to version 3.5.0 resolved the issue:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <version>3.5.0</version>
</plugin>

I also had to upgrade maven to 3.5, since the latest version of the plugin threw a NPE on maven 3.3:

Failed to execute goal org.apache.felix:maven-bundle-plugin:3.5.0:bundle (default-bundle) on project my-bundle: Execution default-bundle of goal org.apache.felix:maven-bundle-plugin:3.5.0:bundle failed. NullPointerException

See also FELIX-5698

UPDATE: Please check for the latest version of the bundle plugin at maven central. The latest version of maven can be found at their download page.

like image 151
gjoranv Avatar answered Oct 02 '22 22:10

gjoranv