<出口包装>使用maven-bundle-plugin获取所有资源 [英] <Export-Package> for all resources using maven-bundle-plugin

查看:108
本文介绍了<出口包装>使用maven-bundle-plugin获取所有资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为能够快速过渡到OSGi的临时措施,我需要创建一个包含所有库的单个jar.我所做的就是将所有jar库都放在src/main/resources中,以便它们最终位于所创建jar的根目录中.我遇到的问题是告诉Maven-bundle-plugin导出jar中的所有软件包.所以基本上,我想将所有库公开给其他OSGi包

As a temporary measure to be able to transition quickly to OSGi I need to create a single jar with all my libraries in it. What i did was put all the jar libraries in src/main/resources so they end up in the root of the created jar. The problem i am having is telling the maven-bundle-plugin to export ALL the packages in the jars. So basically, i want to expose all my libraries to other OSGi bundles

这是我在POM中尝试的第一件事

This is the first thing I tried in my POM

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Export-Package>*</Export-Package>
                    <Bundle-Name>${project.artifactId}</Bundle-Name>
                    <Bundle-Version>${project.version}</Bundle-Version>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>`

我试图导出那里的所有东西.但是看来,唯一像这样导出的是两个osgi依赖关系,而不是资源中的jars

I tried to export everything there was. But it seems that the only thing that gets exported like this are the two osgi dependencies, not the jars in the resources

我有一百多个库,因此我试图找到一种自动填充<Export-Package>指令的方法,而不是手动添加每个librarie的程序包. Eclipse在插件开发环境中以某种方式做到了这一点,但是我需要使用maven做到这一点.捆绑插件完全可以做到这一点吗?如果将罐子添加到<Bundle-ClassPath>

I have over a hundred libraries so i am trying to find an automated way to populate the <Export-Package> directive instead of adding each librarie's package by hand. Somehow eclipse does it in the plugin development environment, but i need to do this using maven. Is this possible with the bundle plugin at all? Extra points if the jars get added to the <Bundle-ClassPath>

推荐答案

我认为这是不可能的.这些jar需要单独存在于Maven仓库中,以便能够通过将其作为依赖项添加到库项目中来创建库项目".否则,罐子将不在类路径中.为此,一个很好的参考是

I think this is not possible. The jars need to be individually in the maven repo to be able to create a "library project" by adding them as dependencies in the library project; otherwise the jars won't be in the classpath. A good reference for doing this is this page

这篇关于&lt;出口包装&gt;使用maven-bundle-plugin获取所有资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆