简体   繁体   English

Maven捆绑软件插件无法生成正确的Export-Package

[英]Maven bundle plugin does not generate right Export-Package

I have several Maven modules for my project. 我的项目有几个Maven模块。 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. 我使用maven-bundle-plugin生成MANIFEST.MF文件,其中包含Import-Package和Export-Package指令。

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. 当我在Export-Package中指定一个软件包时,maven-bundle-plugin会生成MANIFEST.MF, 而没有在配置中指定的软件包。

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: 这是我的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. 并且生成的MANIFEST.MF文件不包含com.company.manager.impl包。

Can anyone help me? 谁能帮我?

Thanks a lot. 非常感谢。 Hejk 赫克

Export-package is misspelled. Export-package拼写错误。 It must be Export-Package . 它必须是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 '.' 现在假定Export-Package是本地Java源中的一组软件包,不包括默认软件包'。'。 and any packages containing 'impl' or 'internal'. 以及包含“ impl”或“ internal”的所有软件包。 (before version 2 of the bundleplugin it was based on the symbolic name) (在bundleplugin版本2之前,它基于符号名称)

My package's name was containing "impl". 我的包裹名称包含“ impl”。 I changed it. 我改了 It works now... 现在可以使用...

Hejk 赫克

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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