【问题标题】:What are the steps to creating a custom Service Mix distribution创建自定义服务组合分发的步骤是什么
【发布时间】:2015-03-26 19:56:03
【问题描述】:

ServiceMix 的documentation 关于创建自定义分发仅说明了创建自定义 karaf 分发的步骤。我知道 Karaf 是 ServiceMix 的骨干,而 ServiceMix 是 Karaf 的自定义发行版。

有没有人真的在 servicemix 之上而不是在 karaf 之上构建了自定义 esb?如果有,你是怎么做到的?

您是如何使用 servicemix 的 src 暂存项目的?

【问题讨论】:

    标签: apache-karaf provisioning apache-servicemix


    【解决方案1】:

    以下是我希望在尝试解决此问题时采取的一些步骤...

    1. 下载您要构建的服务组合版本的源代码:https://github.com/apache/servicemix/releases
    2. 将源 zip 解压到任意文件夹中。
    3. 创建一个具有以下布局的项目:

      • MyESB
        • pom.xml
          • 主要
          • java
    4. apache-service-mix-xxx-src/assembly 中的 pom.xml 中的内容复制到您的 pom.xml

    5. 在那个 pom.xml 中,将 artifactId 和名称替换为如下所示:
    <parent>
      <groupId>org.apache.servicemix</groupId>
      <artifactId>parent</artifactId>
      <version>5.4.0</version>
    </parent>
    
    <groupId>com.mycompany.esb</groupId>
    <artifactId>mycustom-esb</artifactId>
    
    <packaging>pom</packaging>
    <name>Custom :: ESB</name>
    
    • apache-service-mix-x.x.x-src/assembly/src/main的资源目录复制到MyESB/src/main
    • org.apache.karaf.tooling:features-maven-plugin 或刚刚复制的资源目录中的配置文件进行任何自定义。

    例如,如果您想添加特定功能,您可以对 pom.xml 进行以下编辑:

    • 将 features.xml 添加到 add-features-to-repo 配置描述符
    • 将 myfeature 添加到 add-features-to-repo 功能列表中
    • 要默认启动该功能,请将该功能添加到位于此处的 featuresBoot 属性:MyESB\src\main\filtered-resources\etc\org.apache.karaf.features .cfg
    1. 运行 maven 安装目标!这将在 MyESB/target 文件夹中构建一个 zip 文件。现在您可以打开它并运行 servicemix.bat

    2. 启动 ESB 后,通过在 Karaf 控制台中输入以下命令来验证您的功能是否已安装:

      功能:列表 | grep 我的功能

    【讨论】:

      【解决方案2】:

      好吧,就像 servicemix 本身一样。而且,这正是 Karaf 文档中描述的方式。 举个例子,你可能想看看here

      简而言之,在你的自定义程序集POM中定义它,看看下面的sn-p:

          <plugins>
              <plugin>
                  <groupId>org.apache.karaf.tooling</groupId>
                  <artifactId>karaf-maven-plugin</artifactId>
                  <version>${karaf.version}</version>
                  <executions>
                      <execution>
                          <id>add-features-to-repo</id>
                          <phase>compile</phase>
                          <goals>
                              <goal>features-add-to-repository</goal>
                          </goals>
                          <configuration>
                              <descriptors>
                                  <descriptor>mvn:org.apache.karaf.features/standard/${karaf.version}/xml/features</descriptor>
                                  <descriptor>mvn:org.apache.karaf.features/enterprise/${karaf.version}/xml/features</descriptor>
                                  <descriptor>mvn:org.apache.karaf.features/spring/${karaf.version}/xml/features</descriptor>
                                  <descriptor>mvn:org.apache.activemq/activemq-karaf/${activemq.version}/xml/features</descriptor>
                                  <descriptor>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</descriptor>
                                  <descriptor>mvn:org.apache.cxf.karaf/apache-cxf/${cxf.version}/xml/features</descriptor>
                                  <descriptor>file:${basedir}/target/classes/internal.xml</descriptor>
                                  <descriptor>file:${basedir}/target/classes/features.xml</descriptor>
                                  <descriptor>file:${basedir}/target/classes/examples.xml</descriptor>
                              </descriptors>
                              <features>
                                  <feature>cxf</feature>
                                  <feature>obr</feature>
                                  <feature>config</feature>
                                  <feature>standard</feature>
                                  <feature>package</feature>
                                  <feature>kar</feature>
                                  <feature>ssh</feature>
                                  <feature>management</feature>
                                  <feature>eventadmin</feature>
                                  <feature>activemq-broker-noweb</feature>
                                  <feature>activemq-service</feature>
                                  <feature>camel</feature>
                                  <feature>camel-cxf</feature>
                                  <feature>activemq-camel</feature>
                                  <feature>camel-blueprint</feature>
                                  <feature>war</feature>
                                  <feature>jaxrs-api</feature>
                              </features>
                              <includeMvnBasedDescriptors>true</includeMvnBasedDescriptors>
                              <repository>target/features-repo</repository>
                          </configuration>
                          <inherited>false</inherited>
                      </execution>
                  </executions>
              </plugin>
      

      如果您需要自己的自定义捆绑包/功能,请确保您
      a) 为您自己的捆绑包提供功能描述符
      b) 定义特征描述符
      c) 告诉插件使用对应的feature

      【讨论】:

      • 感谢您的回答,但我仍然不清楚从哪里开始。我是下载ServiceMix的源并修改根级别的pom.xml还是从一个空项目开始并使用maven导入服务混合源?当我下载 servicemix 的源代码并尝试构建时,即使在进行任何修改之前,它也会失败。
      • 无需下载源代码,只需创建一个包含 pom 的自定义组装项目,如图所示。 Karaf 堵塞会解决这个问题。如前所述,将您自己的功能描述符或缺少的描述符添加到插件配置中。
      猜你喜欢
      • 2014-08-07
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 1970-01-01
      • 2010-11-09
      • 1970-01-01
      • 1970-01-01
      • 2022-06-12
      相关资源
      最近更新 更多