简体   繁体   中英

Maven bundle plugin does not generate right Export-Package

I have several Maven modules for my project. All these modules are bundles.

I use the maven-bundle-plugin to generate the MANIFEST.MF file which contains Import-Package and Export-Package directives.

When I specify one package in Export-Package then the maven-bundle-plugin generates the MANIFEST.MF without the package I specified in the configuration.

Why does the plugin do that? It is annoying in my case: this bundle has packages needed by another bundle. So I have unresolved dependencies when I try to start my bundles...

Here is an extract of my pom.xml:

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <instructions>
            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
            <Bundle-Description>${project.description}</Bundle-Description>
            <Export-package>com.company.manager.impl</Export-package>
        </instructions>
    </configuration>
</plugin>

And the generated MANIFEST.MF file doesn't contain the com.company.manager.impl package.

Can anyone help me?

Thanks a lot. Hejk

Export-package is misspelled. It must be Export-Package .

Well, I found the source of the error.

According to the plugin's documentation (a little hidden...):

Export-Package is now assumed to be the set of packages in your local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal'. (before version 2 of the bundleplugin it was based on the symbolic name)

My package's name was containing "impl". I changed it. It works now...

Hejk

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