Search code examples
apache-karafprovisioningapache-servicemix

What are the steps to creating a custom Service Mix distribution


ServiceMix's documentation on creating a custom distribution merely states the steps to creating a custom karaf distribution. I understand that Karaf is the backbone of ServiceMix and ServiceMix is a custom distribution of Karaf.

Has anyone actually built a custom esb on top of servicemix rather than on top of karaf? If so how did you do it?

How did you stage the project with servicemix's src?


Solution

  • Here are some steps that I wish I had when trying to figure this out...

    1. Download the sources for the version of service mix you want to build on: https://github.com/apache/servicemix/releases
    2. Unpack the sources zip into any folder.
    3. Create a project with the following layout:

      • MyESB
        • pom.xml
        • src
          • main
          • java
    4. Copy the contents from the pom.xml located in apache-service-mix-x.x.x-src/assembly to your pom.xml

    5. In that pom.xml, replace the artifactId, and name to look something like this:
    <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>
    
    • Copy the resource directories of apache-service-mix-x.x.x-src/assembly/src/main to MyESB/src/main.
    • Make whatever customizations you want to the org.apache.karaf.tooling:features-maven-plugin or the configuratoin files in the resource directories you just copied over.

    For example, If you wanted to add a particular feature you could do the following edits to your pom.xml:

    • Add a features.xml to add-features-to-repo configuration descriptors
    • Add myfeature to the add-features-to-repo features list
    • To have that feature started by default, add the feature to the featuresBoot property located here: MyESB\src\main\filtered-resources\etc\org.apache.karaf.features.cfg
    1. Run the maven install target! This will build a zip file into the MyESB/target folder. Now you can unplack that and run servicemix.bat

    2. After starting your ESB, verify that your feature is installed by entering the following command into the Karaf console:

      features:list | grep myfeature