使用 Maven 和 OSGi 快速周转
我正在寻找一种在开发多模块、maven 构建的 OSGi 应用程序时具有快速周转时间的开发模型。
实际上,最好的解决方案似乎是 Pax Construct 的 maven 插件(反过来又调用 Pax Runner)来配置 maven 生成的包。但是,我没有找到如何借助此(或另一个)maven 插件部署到正在运行的 OSGi 容器的方法。 mvn pax:run
始终重新启动 OSGi 平台。 AFAIK 也不可能部署到不受 Pax Runner 管理的现有 OSGi 容器(例如 Glassfish v3 或 SpringSource dm Server)。
是否存在一个 Maven 插件,允许快速将 Maven 模块部署到正在运行的 OSGi 容器,理想情况下能够挂钩到打包生命周期阶段?
使用 Maven 开发基于 OSGi 的应用程序时,您的开发周期是怎样的?
I'm looking for a developmentn model with fast turnaround times when developing a multi-module, maven built, OSGi application.
Actually, the best solution seems to be Pax Construct's maven plugin (which in turn calls Pax Runner) for provisioning maven generated bundles. However, I didn't find a way howto deploy to a running OSGi container with help of this (or another) maven plugin. mvn pax:run
always starts the OSGi platform afresh. AFAIK it is also not possible to deploy to an already exisiting OSGi container not managed by Pax Runner (e.g. Glassfish v3 or SpringSource dm Server).
Does there exist a maven plugin which allows for quickly deploying a maven module to a running OSGi container, ideally being able to hook into the packaging
lifecycle phase ?
How is your development cycle when developing OSGi based applications with maven ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 glassfish,您可以将 maven 的 target/ 目录配置为由 GlassFish 监视更新,然后 GlassFish 将自动安装和安装。创建 jar 时启动它,删除 jar 时将卸载它,并在目标目录中更新 jar 时更新包。要实现此目的,请创建一个名为 org.apache.felix.fileinstall-maven.cfg 的文件,
其内容如下:
felix.fileinstall.dir=/路径/到/目标/
felix.fileinstall.poll=5000
felix.fileinstall.bundles.new.start=true
将此文件放入 domain1/autodeploy/bundles/
如有进一步问题,请邮寄 glassfish 用户别名。
萨胡
If you are using glassfish, you can configure maven's target/ directory to be watched by GlassFish for updates and then GlassFish will automatically install & start the jar when it gets created, it will uninstall it when the jar gets deleted and update the bundle, when the jar gets updated in target directory. To achieve this, create a file called
org.apache.felix.fileinstall-maven.cfg with content like this:
felix.fileinstall.dir=/path/to/target/
felix.fileinstall.poll=5000
felix.fileinstall.bundles.new.start=true
Place this file in domain1/autodeploy/bundles/
For further questions, mail glassfish users alias.
Sahoo
我不知道有什么通用插件可以做到这一点,但是,使用 GlassFish,在调用部署时使用
--type osgi
参数来部署 OSGI 包:遗憾的是,我找不到对该类型的任何支持maven-glassfish-plugin 中的选项。但是, maven-embedded-glassfish-plugin< /a> 确实有一个
embedded-glassfish:admin
目标,允许:该插件没有详细记录,其设置需要进行一些调查,我没有对此进行测试,但是,如果您可以将
--type osgi
传递给embedded-glassfish:admin
目标(这是我的理解),那么应该可以将目标绑定到特定阶段并执行 OSGI 捆绑部署作为标准构建的一部分。I don't know any generic plugin doing that but, with GlassFish, deploying an OSGI bundle invovles using the
--type osgi
parameter when calling deploy:Sadly, I couldn't find any support for the type option in the maven-glassfish-plugin. However, the maven-embedded-glassfish-plugin does have a
embedded-glassfish:admin
goal allowing to:The plugin is not well documented, its setup will require some investigation and I didn't test this but, if you can pass
--type osgi
to theembedded-glassfish:admin
goal (which is my understanding), then it should be possible to bind the goal on a particular phase and to perform an OSGI bundle deployment as part of your standard build.