简体   繁体   中英

OSGi: Apache Felix Maven Bundle Plugin and Javadoc

I'm using the Apache Felix Maven Bundle Plugin to generate the OSGi metadata.

<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>

You can configure which packages are exported or you can use the default, which excludes packages such as *.impl.* and *.internal.*.

Is there a way to generate Javadoc only for the exported packages without having to duplicate this information?

Edit:

My current approach is that I set the excludePackageNames property (a Maven Javadoc Plugin property) manually and thus duplicate this information:

<excludePackageNames>*.internal.*:*.impl.*</excludePackageNames> <!-- used by Javadoc plugin --><!-- TODO: get this from OSGi meta data-->

http://sourceforge.net/p/drombler/drombler-oss-parent/ci/default/tree/pom.xml#l64

The Apache Maven bundle plugin is based on bndlib , which has its own plugin model. If a maven plugin model has class visibility to other maven plugins then it is easy to get this information. In the instructions in the pom register a plugin:

<instructions>
  <_plugin>com.example.MyPlugin</_plugin>
</instruction>

In this bnd plugin, implement the AnalyzerPlugin interface

boolean analyzeJar(Analyzer analyzer) throws Exception {
   doJavadoc( analyzer.getExportedPackages().keySet() );
}

I am not that familiar with maven plugins, since bnd will do dynamic class loader (yuck), it must be able to see your code.

I guess the best thing would be, if the Maven Bundle Plugin would provide a goal to generate the needed information.

I filed a new issue: https://issues.apache.org/jira/browse/FELIX-4181

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM