发布karaf的features

Karaf的features是其本身的一大亮点,通过features可以完成某个功能相关bundle的安装和卸载,极大的方便了对bundle的管理。

Karaf的最新版本是2.3.2,通过features:install 命令,安装的features都是在data目录下,这个目录你可以整个的清空,就可以恢复karaf的最初状态。如果我们在开发过程中,打算把你弄好的环境发布出去,该如何完成呢?

带着这个问题,查了karaf的用户手册,发现karaf也提供了相应的支持,不得不感叹老外开发的东西就是全面,只要你有需求,人家都帮你弄好了。

1.安装features插件

<plugin>
                <groupId>org.apache.karaf.tooling</groupId>
                <artifactId>features-maven-plugin</artifactId>
                <version>2.3.2</version>

                <executions>
                    <execution>
                        <id>add-features-to-repo</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-features-to-repo</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>file:D:/myJavaTools/apache-karaf-2.3.2/etc/drools.xml</descriptor>
                                <!--<descriptor>mvn:org.apache.activemq/activemq-karaf/5.8.0/xml/features</descriptor>-->
                                <!--<descriptor>mvn:org.apache.karaf.assemblies.features/standard/2.3.2/xml/features</descriptor>-->
                            </descriptors>
                            <features>
                                <feature>war</feature>
                                <feature>webconsole</feature>
                                <feature>drools-common</feature>

                            </features>
                            <repository>${project.build.directory}/features-repo</repository>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
说明:这里我自定义了drools.xml,这个文件时我在drools的官网上下载到本地的,我打算在karaf中预先安装war,webconsole以及drools-common三种features。
执行mvn install后,会在target/features-repo下看到生成的jar包,这些jar是以maven库的格式组织的。

2.修改karaf的启动配置

打开 org.apache.karaf.features.cfg文件,修改如下:
################################################################################
#
#    Licensed to the Apache Software Foundation (ASF) under one or more
#    contributor license agreements.  See the NOTICE file distributed with
#    this work for additional information regarding copyright ownership.
#    The ASF licenses this file to You under the Apache License, Version 2.0
#    (the "License"); you may not use this file except in compliance with
#    the License.  You may obtain a copy of the License 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值