javaosgibndmaven-bundle-plugin

Maven Bundle Plugin: Export has private references


After updating the maven-bundle-plugin from version 2.3.5 to version 2.4.0 running mvn clean install outputs some warning messages, which I don't fully understand. E.g.

Export ch.entwine.weblounge.contentrepository.impl.index, has 1, private references [org.elasticsearch.action.bulk]

I guess this has something to do with an embedded lib (elasticsearch). Here are parts of the POM:

<dependencies>
  ...
  <dependency>
    <groupId>org.elasticsearch</groupId>
    <artifactId>elasticsearch</artifactId>
    <version>0.19.9</version>
  </dependency>
  ...
</dependencies
...
<Export-Package>
  ...
  ch.entwine.weblounge.contentrepository.impl.index
  ...
</Export-Package>
<Embed-Dependency>
  ....
  elasticsearch;inline=true
  ...
</Embed-Dependency>

What does the error message exactly mean? What is the recommended way to solve such problems?


Solution

  • That message means that inside one of your public packages (that you are exporting) there is a class that is accessing a class that is in a private package (a package that is not being exported).

    When embedding jars you must not use Export-Package to declare packages from the embedded jars. it is for you declare the packages from the own bundle. You must use <_exportcontents> to export org.elasticsearch.action.bulk.