Chapter 3. Upgrading Fuse applications on Karaf standalone
To upgrade your Fuse applications on Karaf, you must update your Fuse project’s Maven dependencies to ensure that you are using the correct version of Fuse.
Typically, you use Maven to build Fuse applications. Maven is a free and open source build tool from Apache. Maven configuration is defined in a Fuse application project’s pom.xml
file. While building a Fuse project, the default behavior is that Maven searches external repositories and downloads the required artifacts. You add a dependency for the Fuse Bill of Materials (BOM) to the pom.xml
file so that the Maven build process picks up the correct set of Fuse supported artifacts.
The following sections provide information on Maven dependencies and how to update them in your Fuse projects.
3.1. About Maven dependencies
The purpose of a Maven Bill of Materials (BOM) file is to provide a curated set of Maven dependency versions that work well together, saving you from having to define versions individually for every Maven artifact.
There is a dedicated BOM file for each container in which Fuse runs.
You can find these BOM files here: https://github.com/jboss-fuse/redhat-fuse. Alternatively, go to the latest Release Notes for information on BOM file updates.
The Fuse BOM offers the following advantages:
-
Defines versions for Maven dependencies, so that you do not need to specify the version when you add a dependency to your
pom.xml
file. - Defines a set of curated dependencies that are fully tested and supported for a specific version of Fuse.
- Simplifies upgrades of Fuse.
Only the set of dependencies defined by a Fuse BOM are supported by Red Hat.
3.2. Updating your Fuse project’s Maven dependencies
To upgrade your Fuse application for Karaf, update your project’s Maven dependencies.
Procedure
-
Open your project’s
pom.xml
file. Add a
dependencyManagement
element in your project’spom.xml
file (or, possibly, in a parentpom.xml
file), as shown in the following example:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project ...> ... <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- configure the versions you want to use here --> <fuse.version>7.4.0.fuse-740036-redhat-00002</fuse.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>fuse-karaf-bom</artifactId> <version>${fuse.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> ... </project>
-
Save your
pom.xml
file.
After you specify the BOM as a dependency in your pom.xml
file, it becomes possible to add Maven dependencies to your pom.xml
file without specifying the version of the artifact. For example, to add a dependency for the camel-velocity
component, you would add the following XML fragment to the dependencies
element in your pom.xml
file:
<dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-velocity</artifactId> <scope>provided</scope> </dependency>
Note how the version
element is omitted from this dependency definition.