When working with the FUSE ESB JBI Maven tooling, you will want to create a top-level project that can build all of the service units and package them into a service assembly. Using a top-level project for this purpose has several advantages. It allows you to control the dependencies for all of the parts of an application in a central location. It limits the number of times you need to specify the proper repositories to load. It also gives you a central location from which to build and deploy the application.
The top-level project is responsible for assembling the application. It will use the Maven assembly plug-in and list your service units and the service assembly as modules of the project.
Your top-level project will contain the following directories:
a source directory containing the information needed by the Maven assembly plug-in
a directory to hold the service assembly project
at least one directory containing a service unit project
![]() | Tip |
---|---|
You will need a project folder for each service unit that is to be included in the generated service assembly. |
In order to use the FUSE ESB JBI Maven tooling, you add the elements shown in Example C.1 to your top-level POM file.
Example C.1. POM Elements for Using FUSE ESB Tooling
...
<pluginRepositories>
<pluginRepository>
<id>fusesource.m2</id>
<name>FUSE Open Source Community Release Repository</name>
<url>http://repo.fusesource.com/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fusesource.m2</id>
<name>FUSE Open Source Community Release Repository</name>
<url>http://repo.fusesource.com/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>fusesource.m2-snapshot</id>
<name>FUSE Open Source Community Snapshot Repository</name>
<url>http://repo.fusesource.com/maven2-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.servicemix.tooling</groupId>
<artifactId>jbi-maven-plugin</artifactId>
<version>servicemix-version
</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
...
These elements point Maven to the correct repositories to download the FUSE ESB Maven tooling and load the plug-in that implements the tooling.
Your top-level POM lists all of the service units and the service assembly that will be
generated as modules. The modules are contained in a modules
element. The modules
element contains
one module
element for each service unit in the assembly. You will also need a module
element for the
service assembly.
The modules should be listed in the order in which they are built. This means that the service assembly module should be listed after all of the service unit modules.
Example C.2 shows a top-level pom for a project that contains a single service unit.
Example C.2. Top-Level POM for a FUSE ESB JBI Project
<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> <parent> <groupId>com.widgets</groupId> <artifactId>demos</artifactId> <version>1.0</version> </parent> <groupId>com.widgets.demo</groupId> <artifactId>cxf-wsdl-first</artifactId> <name>CXF WSDL Fisrt Demo</name> <packaging>pom</packaging> <pluginRepositories><pluginRepository> <id>fusesource.m2</id> <name>FUSE Open Source Community Release Repository</name> <url>http://repo.fusesource.com/maven2</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </pluginRepository> </pluginRepositories> <repositories> <repository> <id>fusesource.m2</id> <name>FUSE Open Source Community Release Repository</name> <url>http://repo.fusesource.com/maven2</url> <snapshots> <enabled>false</enabled> </snapshots> <releases> <enabled>true</enabled> </releases> </repository> <repository> <id>fusesource.m2-snapshot</id> <name>FUSE Open Source Community Snapshot Repository</name> <url>http://repo.fusesource.com/maven2-snapshot</url> <snapshots> <enabled>true</enabled> </snapshots> <releases> <enabled>false</enabled> </releases> </repository> </repositories> <modules>
<module>wsdl-first-cxfse-su</module> <module>wsdl-first-cxf-sa</module> </modules> <build> <plugins> <plugin>
<groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.1</version> <inherited>false</inherited> <executions> <execution> <id>src</id> <phase>package</phase> <goals> <goal>single</goal> </goals> <configuration> <descriptors> <descriptor>src/main/assembly/src.xml</descriptor> </descriptors> </configuration> </execution> </executions> </plugin> <plugin>
<groupId>org.apache.servicemix.tooling</groupId> <artifactId>jbi-maven-plugin</artifactId> <extensions>true</extensions> </plugin> </plugins> </build> </project>
The POM shown in Example C.2 does the following:
Configures Maven to use the FUSE repositories for loading the FUSE ESB plug-ins. | |
Lists the sub-projects used for this application. The | |
Configures the Maven assembly plug-in. | |
Loads the FUSE ESB JBI plug-in. |