通过 Maven bundle 和 Sling 插件安装 OSGI 依赖项



我有一个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>

该捆绑包是通过 maven-sling-plugin 安装的。

我有一个更快的xml.jackson依赖项,它作为osgi包存在于我的.m2存储库中,并充当我的项目中的依赖项。

如何让 maven 将此依赖项也部署为 osgi 捆绑包?

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

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

编辑:

简单化:

如何让 maven 意识到我在我的 pom 中称为依赖项的 osgi 捆绑包.xml应该与依赖于它的捆绑包一起安装在 osgi 容器中?

您可能会

发现最好将捆绑包与/content一起打包为应用程序的一部分,/apps /apps/myapp/install文件夹中的应用程序部分将导致 JCR 安装程序提供程序将库安装为捆绑包。

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

  • http://www.cognifide.com/blogs/cq/maven-plugin-automating-deployments-of-crx-cq-applications/
  • http://mkalugin-cq.blogspot.co.uk/2012/11/how-to-use-maven-project-to-create.html
  • http://labs.sixdimensions.com/blog/dklco/2012-05-03/introducing-cq-deploy-maven-plugin-deploying-cq-projects
  • http://dev.day.com/docs/en/cq/current/core/how_to/how_to_use_the_vlttool/vlt-mavenplugin.html

或者,您可以使用CRXDE放置捆绑包,然后使用CRX包管理器来测试该方法,稍后它们将进入自动打包。

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

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

最新更新