15

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.

3 Answers 3

30

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks.This is great.I am still on Maven 3.3.9 and the maven bundle plugin version 3.5.0 worked on Java 1.8.0_131 when I faced a similar issue
2

If you're using IntelliJ, this issue may appear despite your maven configuration being up to date because of this issue: https://youtrack.jetbrains.com/issue/IDEA-194358

The workaround is to turn off the Osmorc plugin

Comments

2

I've been having the same issue. After a lot of playing, I found out that it was the uber-jar that was the root cause. YMMV.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.