Skip to content

Instantly share code, notes, and snippets.

@rafaeltuelho
Created February 26, 2015 14:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeltuelho/dcd85589a93c17d9f79f to your computer and use it in GitHub Desktop.
Save rafaeltuelho/dcd85589a93c17d9f79f to your computer and use it in GitHub Desktop.
Maven POM sample to install a JAR artifact as a FAB deployment in JBoss Fuse 6.x
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.net.rafaeltuelho</groupId>
<artifactId>camel-blueprint-sample</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>A Camel Blueprint Route</name>
<url>http://www.myorganization.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>snapshot.fusesource.org</id>
<name>FuseSource Snapshot Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>snapshot.fusesource.org</id>
<name>FuseSource Snapshot Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.10.0.redhat-60024</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>2.10.0.redhat-60024</version>
<scope>provided</scope>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test-blueprint</artifactId>
<version>2.10.0.redhat-60024</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- to generate the MANIFEST-FILE of the FAB Jar file with FAB-specific headers -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<index>true</index>
<manifestEntries>
<FAB-Version-Range-Digits>0</FAB-Version-Range-Digits>
<FAB-Provided-Dependency>
org.apache.camel:*
org.apache.cxf:*
org.apache.activemq:*
</FAB-Provided-Dependency>
</manifestEntries>
</archive>
</configuration>
</plugin>
<!-- to run the example using mvn camel:run -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.10.0.redhat-60024</version>
<configuration>
<useBlueprint>true</useBlueprint>
</configuration>
</plugin>
</plugins>
</build>
</project>
@rafaeltuelho
Copy link
Author

Follows these steps to tryout a FAB deployment in JBoss FUSE 6.x:

  • generate a sample Camel project based on a Maven Archetype
mvn archetype:generate -DarchetypeGroupId=org.apache.camel.archetypes -DarchetypeArtifactId=camel-archetype-blueprint -DarchetypeVersion=2.10.0.redhat-60024 -DgroupId=br.net.rafaeltuelho -DartifactId=camel-blueprint-sample -Dversion=0.0.1-SNAPSHOT
  • change the project POM adding
  • pkg type to JAR
  • dependencies to provided
  • optionally use the maven-jar-plugin to specify some FAB specific MANIFEST Headers
  • Install the artifact into your maven local repo
mvn install
  • Install the FAB inside the container
JBossFuse:karaf@root> osgi:install fab:mvn:br.net.rafaeltuelho/camel-blueprint-sample/0.0.1-SNAPSHOT

Note the fab: prefix used to install the artifact as a FAB!


  • Start/Stop the FAB main bundle
JBossFuse:karaf@root> fab:start 262
JBossFuse:karaf@root> fab:stop 262

Use some fab: Karaf commands to inspect the FAB metadata information.
See some inspect commands

  • OSGI Bundle list after FAB installation
JBossFuse:karaf@root> osgi:list
....
[ 262] [Installed  ] [            ] [       ] [   60] br.net.rafaeltuelho.camel-blueprint-sample (0.0.1.SNAPSHOT)
[ 263] [Installed  ] [            ] [       ] [   60] Apache Aries Blueprint API (1.0.1.redhat-60024)
[ 264] [Installed  ] [            ] [       ] [   60] OSGi System Bundle (3.5.0.v20090520)
[ 265] [Installed  ] [            ] [       ] [   60] file__home_rsoares_.m2_repository_org_apache_aries_org.apache.aries.util-r42_1.0.1.redhat-60024_org.apache.aries.util-r42-1.0.1.redhat-60024.jar (0)
[ 266] [Installed  ] [            ] [       ] [   60] Apache Aries Blueprint Core (1.0.1.redhat-60024)
[ 267] [Installed  ] [            ] [       ] [   60] Apache Aries Blueprint Bundle (1.0.1.redhat-60024)
[ 268] [Installed  ] [            ] [       ] [   60] camel-core (2.10.0.redhat-60024)
[ 269] [Installed  ] [            ] [       ] [   60] osgi.cmpn (4.3.1.201210102024)
  • FAB Info
JBossFuse:karaf@root> fab:info 262
URL: mvn:br.net.rafaeltuelho/camel-blueprint-sample/0.0.1-SNAPSHOT

Non-shared dependencies (embedded in FAB):
    com.sun.xml.bind.jaxb-impl-resources.jar
    org.eclipse.osgi-resources.jar

Shared dependencies (installed as bundles when necessary):
    mvn:com.sun.xml.bind/jaxb-impl/2.2.5
    mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.annotation.api/1.0.1.redhat-60024
    mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.0.1.redhat-60024
    mvn:org.apache.aries.proxy/org.apache.aries.proxy.api/1.0.1.redhat-60024
    mvn:org.apache.aries.quiesce/org.apache.aries.quiesce.api/1.0.0
    mvn:org.eclipse/osgi/3.5.0.v20090520
    mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.1.redhat-60024
    mvn:org.apache.aries/org.apache.aries.util-r42/1.0.1.redhat-60024
    mvn:org.apache.aries/org.apache.aries.util/1.0.1.redhat-60024
    mvn:org.apache.aries.blueprint/blueprint-parser/1.0.1.redhat-60024
    mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.0.1.redhat-60024
    mvn:org.apache.aries.blueprint/org.apache.aries.blueprint/1.0.1.redhat-60024
    mvn:org.apache.camel/camel-core-osgi/2.10.0.redhat-60024
    mvn:org.apache.camel/camel-core-xml/2.10.0.redhat-60024
    mvn:org.osgi/org.osgi.compendium/4.3.1
    mvn:org.osgi/org.osgi.core/4.3.1
    mvn:org.apache.camel/camel-core/2.10.0.redhat-60024
    mvn:org.apache.camel/camel-blueprint/2.10.0.redhat-60024

No additional features required

No additional features repositories required

For more information about this FAB:
  use 'fab:headers 262' to view the OSGi headers
  use 'fab:tree 262' to view a tree representation of the dependencies
  • FAB Dependency tree view
JBossFuse:karaf@root> fab:tree 262
+- br.net.rafaeltuelho.camel-blueprint-sample [0.0.1-SNAPSHOT]
   +- org.apache.camel.camel-blueprint [2.10.0.redhat-60024] (shared)
   |  +- com.sun.xml.bind.jaxb-impl [2.2.5] (shared)
   |  +- org.apache.aries.blueprint;blueprint.graceperiod:=false [1.0.1.redhat-60024] (shared)
   |  |  +- org.apache.aries.blueprint.annotation.api [1.0.1.redhat-60024] (shared)
   |  |  +- org.apache.aries.blueprint.cm [1.0.1.redhat-60024] (shared)
   |  |  +- org.apache.aries.proxy.api [1.0.1.redhat-60024] (shared)
   |  |  +- org.apache.aries.quiesce.api [1.0.0] (shared)
   |     +- org.eclipse.osgi; singleton:=true [3.5.0.v20090520] (shared)
   |  +- org.apache.camel.camel-core-osgi [2.10.0.redhat-60024] (shared)
   |  +- org.apache.camel.camel-core-xml [2.10.0.redhat-60024] (shared)
   |  +- osgi.cmpn [4.3.1] (shared)
      +- osgi.core [4.3.1] (shared)
  • FAB package Import/Export headers
JBossFuse:karaf@root> fab:headers 262
Manifest-Version = 1
Bnd-LastModified = 1424918732991
Archiver-Version = Plexus Archiver
Tool = Bnd-1.43.0
Originally-Created-By = Apache Maven 3.2.1
FAB-URL = mvn:br.net.rafaeltuelho/camel-blueprint-sample/0.0.1-SNAPSHOT
FAB-Provided-Dependency = org.apache.cxf:* org.apache.camel:* org.apache.activemq:*
Generated-By-FAB-From = mvn:br.net.rafaeltuelho/camel-blueprint-sample/0.0.1-SNAPSHOT
Built-By = rsoares
FAB-Exclude-Dependency = org.slf4j:* commons-logging:* log4j:*
Build-Jdk = 1.7.0_75
FAB-Id = br.net.rafaeltuelho:camel-blueprint-sample:0.0.1-SNAPSHOT:jar
Created-By = 1.7.0_75 (Oracle Corporation)
FAB-Version-Range-Digits = 0

Bundle-Name = br.net.rafaeltuelho.camel-blueprint-sample
Bundle-SymbolicName = br.net.rafaeltuelho.camel-blueprint-sample
Bundle-Version = 0.0.1.SNAPSHOT
Bundle-ManifestVersion = 2
Bundle-ClassPath = .,com.sun.xml.bind.jaxb-impl-resources.jar,org.eclipse.osgi-resources.jar,org.apache.camel.camel-core-resources.jar

Private-Package = 
        .
Import-Package = 
        org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
        org.eclipse.osgi.framework.debug,
        org.apache.camel.fabric;version=2.10.0.redhat-60024,
        org.eclipse.osgi.internal.provisional.verifier,
        org.apache.camel.model.loadbalancer;version=2.10.0.redhat-60024,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment