What is the meaning of type “bundle” in a maven dependency?

喜夏-厌秋 提交于 2019-12-17 15:24:21

问题


What is the meaning of "bundle" e.g in this dependency:

<dependency>
    <groupId>org.apache.abdera</groupId>
    <artifactId>abdera-core</artifactId>
    <version>1.1.2</version>
    <type>bundle</type>
    <scope>compile</scope>
</dependency>

回答1:


This kind of artifact is an OSGi bundle, typically produced using the maven-bundle-plugin which is part of Apache Felix.

The plugin treats all the classes available to your module (the module's own classes, classes provided by dependencies, other classes on the classpath) as one giant set, then lets you select a subset of those classes to bundle into a jar. It also creates the necessary manifest information to make the artifact an OSGi bundle.

So the artifact you're pulling in by using this dependency is a jar, however it's a jar built by choosing a subset from a much larger set of classes, not just the classes that were defined inside the abdera-core module.

If you have a look at the pom for the abdera project you'll see the maven-bundle-plugin configuration which will give you an idea of which classes have been added to the bundle, and which have been held back.



来源:https://stackoverflow.com/questions/5389691/what-is-the-meaning-of-type-bundle-in-a-maven-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!