osgi - 通过 Maven Bundle 和 sling 插件安装 osgi 依赖项

标签 osgi sling maven-bundle-plugin

我有一个 osgi-bundle,它是使用 maven-bundle-plugin 创建的:

<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <configuration>
    <instructions>
      <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
    </instructions>
  </configuration>
</plugin>

该 bundle 是通过 maven-sling-plugin 安装的。

我有一个 fastxml.jackson 依赖项,它作为 osgi-bundle 存在于我的 .m2 存储库中,并充当我的项目中的依赖项。

如何让 Maven 也将此依赖项部署为 osgi-bundle?

目前我必须在我的 osgi 容器中手动安装它。

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.2.2</version>
</dependency>

编辑:

简化:

如何让 Maven 意识到我在 pom.xml 中称为依赖项的 osgi-bundle 应与依赖于它的包一起安装在 osgi-container 中?

最佳答案

您可能会发现最好将 bundle 与应用程序的 /content/apps 部分一起打包为应用程序的一部分,位于 /apps/myapp/install 文件夹将导致库被 jcr installer 作为 bundle 安装提供商。

这些文章中描述了几种使用 Maven 自动打包/部署应用程序的方法:

或者,您可以只使用 CRXDE 放置 bundle ,然后使用 CRX Package Manager 来测试该方法,稍后再进行自动打包。

如果你不想重新打包两个OSGI包,可以使用sling maven插件直接安装jackson包

mvn org.apache.sling:maven-sling-plugin:install-file -Dsling.file=jackson-databind-2.2.2.jar

关于osgi - 通过 Maven Bundle 和 sling 插件安装 osgi 依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18869192/

相关文章:

java - 如何从 OSGi 组件中的第三方 jar 文件导入类

java - Ajax : Not able to redirect to a content page inside AEM SLING servlet

java - OSGi:Apache Felix Maven 捆绑插件和 Javadoc

java - 如何使用声明式服务管理多个服务实例?

java - OSGi环境: how to update during runtime a class reference

eclipse - 哪个版本的 OSGi 由哪个版本的 Eclipse/Equinox 实现?

aem - 在 AEM 6.2 中,如何在已有可编辑页面模板的网站上创建静态页面模板?

java - 带有 Maven bundle 插件的 OSGi 未加载库

java - 仅在重新启动后 Karaf 中出现 ClassCastException

testing - 将属性注入(inject)Sling Model的最佳方法是什么?