我有一个 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 自动打包/部署应用程序的方法:
- 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 放置 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/