jca*_*ert 28 java osgi maven-2 dependency-management
OSGi似乎通过不将大量JAR依赖项包装到lib目录中而具有小型可部署工件的优点.但是,我找不到任何能告诉我将依赖项部署到容器的简单可靠方法.例如,我有一个使用CXF和几个Spring子项目的应用程序.如果我需要将此应用程序部署到新的Glassfish服务器,那么最好的方法是什么,确保安装所有依赖项?
我正在使用Maven,似乎可以通过某种方式获得一个查看META-INF/maven目录的钩子并从pom.xml中提取依赖项列表并获取所需的库(可能来自当地的回购).有没有办法做到这一点?
Pax插件听起来像是在做这个,但它似乎是基于提升一个Felix容器?这不是我想要的,我正在处理已经运行的远程容器.
是否有任何镜头这样的东西存在作为命令行工具而不是GUI?
小智 38
有许多方法可以将依赖包部署到OSGi容器.这里是其中的一些:
首先需要使用bindex等工具为可用的包创建XML索引文件.如果您使用的是maven-bundle-plugin,那么它会自动在〜/ .m2/repository/repository.xml中维护一个OBR索引.
使用OBR命令行界面加载索引:
> obr:addUrl file:/Users/derek/.m2/repository/repository.xml
Run Code Online (Sandbox Code Playgroud)
然后要求OBR部署您的目标包,并根据OBR索引确定依赖关系:
> obr:deploy com.paremus.posh.sshd
Target resource(s):
-------------------
Paremus Posh Ssh Daemon (1.0.23.SNAPSHOT)
Required resource(s):
---------------------
Paremus Command API (1.0.23.SNAPSHOT)
Optional resource(s):
---------------------
Paremus Config Admin Commands (1.0.23.SNAPSHOT)
Paremus OSGi & LDAP Types (1.0.23.SNAPSHOT)
Run Code Online (Sandbox Code Playgroud)
Karaf支持"功能",它基本上是提供功能所需的捆绑包列表:
karaf@root> features:info obr
Description of obr 2.0.0 feature
----------------------------------------------------------------
Feature has no configuration
Feature has no dependencies.
Feature contains followed bundles:
mvn:org.apache.felix/org.apache.felix.bundlerepository/1.6.4
mvn:org.apache.karaf.shell/org.apache.karaf.shell.obr/2.0.0
mvn:org.apache.karaf.features/org.apache.karaf.features.obr/2.0.0
karaf@root> features:install obr
Run Code Online (Sandbox Code Playgroud)
Virgo使用计划来定义构成应用程序的工件,并且能够从本地和远程存储库自动提供应用程序的依赖关系,包括包,计划,计划存档(PAR)和配置.
Nimble使用OBR(或其自己的扩展)存储库索引来自动部署激活目标包所需的所有依赖包(并在目标包停止时卸载它们).它还可以检测其他依赖项,例如WAB捆绑包需要Web扩展程序,并根据可配置的策略自动安装.
Nimble还可以配置为启动Glassfish,以便Glassfish容器中的捆绑包可以使用它的功能.
以下示例还显示在激活sshd时自动安装日志记录支持:
$ posh
________________________________________
Welcome to Paremus Nimble!
Type 'help' for help.
[denzil.0]% nim:add --dry-run com.paremus.posh.sshd@active
-- sorted parts to install --
4325 osgi.resolved.bundle/ch.qos.logback.core:0.9.22
-- start dependency loop --
5729 osgi.resolved.bundle/com.paremus.util.logman:1.0.23.SNAPSHOT
5727 osgi.active.bundle/com.paremus.util.logman:1.0.23.SNAPSHOT
3797 osgi.resolved.bundle/ch.qos.logback.classic:0.9.25.SNAPSHOT
3792 osgi.resolved.bundle/slf4j.api:1.6
-- end dependency loop --
436 osgi.resolved.bundle/org.apache.mina.core:2.0.0.RC1
6533 osgi.resolved.bundle/sshd-core:0.3
398 osgi.resolved.bundle/com.paremus.posh.sshd:1.0.23.SNAPSHOT
396 osgi.active.bundle/com.paremus.posh.sshd:1.0.23.SNAPSHOT
Run Code Online (Sandbox Code Playgroud)
(免责声明:我是Paremus的开发人员)
gogo是新的RFC147标准命令行shell.它已经在Felix,Karaf,Nimble中使用,很快就会在Glassfish中使用.
Gogo允许您以脚本的形式运行可以交互式输入的任何命令.因此,您可以生成要安装的软件包列表并将其转换为脚本,甚至从工作配置中捕获已安装的软件包,以便可以从干净的开始重新创建它.
| 归档时间: |
|
| 查看次数: |
15670 次 |
| 最近记录: |