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

gjoranv :

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.

gjoranv :

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=37120&siteId=1