Artifact Management for JBoss Fuse

This article is a quick tutorial for integrating your Fuse development work-flow with a remote artifact management tool. I'll use the community version of Artifactory as an example.

Artifactory Setup

To set up an instance of Artifactory, you may follow the extensive instructions on the JFrog Website. For an even more hands-off approach, I used an Ansible role that I discovered here: bbaassssiiee/artifactory. In addition, I found the following two roles were helpful for installing Java and MariaDB: PCextreme/ansible-role-mariadb and geerlingguy/ansible-role-java.

The Artifactory UI is exposed by default at http://[artifactory-host]:8081/artifactory. Log in as the administrator. If you have not configured any security, the credentials will be admin:password, by default.

Create at least one user to get started security > users > new. There are some integration options for security, but for now, we will assume that users are managed by Artifactory's internal database. A new user will be automatically associated with the readers default security group, which has read privileges for all repositories. I found that the minimum effort to give the new user write permissions was to create a new group, e.g. publishers, via security > groups > new, add the desired user(s) to the group, then configure permissions on via security > permissions by editing the Anything permission in the Groups tab. There, you can add the new group, e.g. publishers and enable Deploy/Cache, which automatically enables Annotate and Read.

POM Configuration

On the project level in your POM files, include a section that describes how artifacts should be published. Here is an example:

    <name>OS1 Artifactory - Releases</name>
    <name>OS1 Artifactory - Snapshots</name>

It is generally a good idea to keep information like this abstracted from individual projects by inheriting from a parent POM.

Local Maven Configuration

Configure credentials for the Artifactory URLs set in POM files by editing local Maven settings, e.g. ~/.m2/settings.xml.

Be sure to describe servers for each repository ID configured in POMs. In this example, the identifiers were releases-artifactory and snapshots-artifactory.

Configure your Artifactory username and use the Artifactory UI to copy an encrypted version of your password. To copy the password, click on your username in the Artifactory UI, and type in your password to unlock the screen. You can view or copy the encrypted password there. Here is an example:

<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="" xmlns="" xmlns:xsi="">

Verify Deployment

With Artifactory and Maven configured, you should be able to verify the ability to publish to one of the local repositories. I used created a new Fuse Project in the JBoss Fuse IDE with the camel-archetype-blueprint archetype. Add the distribution management configuration described earlier. Unfortunately, the unit test fails in the example, so you can either skip tests, or edit on line 11, and change the path /OSGI-INF/blueprint/blueprint.xml to OSGI-INF/blueprint/blueprint.xml; in other words, remove the beginning slash. Build the example and publish to Artifactory with mvn deploy. The uploaded artifact should be evident in the UI.

Configure Fuse

In order to point Fuse to Artifactory, edit the default profile via the Fuse console or the Hawtio Wiki tab. Edit the property file named Add the Artifactory virtual repository URLs to the org.ops4j.pax.url.mvn.repositories list. For example:

org.ops4j.pax.url.mvn.repositories= \
    file:${runtime.home}/${karaf.default.repository}@snapshots@id=karaf-default, \
    file:${}/maven/upload@snapshots@id=fabric-upload, \, \, \, \, \, \, \, \
    http://[artifactory-host]:8081/artifactory/libs-release@id=releases-artifactory, \

It is a common practice to link to the virtual repositories as opposed to the local repositories here because they may link other sources. In some cases, users may not want Fuse to have any direct Internet access, in which case Artifactory can provide a proxy for all sources, and the only URLs in the profile would be Artifactory virtual repositories.

Verify Fuse Configuration

Assuming you are testing with the recommended camel-archetype-blueprint example, deployment will require a simple profile. Create a new Fabric8 Profile, and add the bundle from Artifactory, e.g. com.example/camel-blueprint/1.0.0-SNAPSHOT.

Create a child container, and add the new profile along with the camel-feature profile. Start up the container, and connect to it via the Fuse console. Use the command log:tail to view output. Camel should be saying "Hi" every five seconds.

Next test that you can overwrite an existing snapshot with a new version. I changed the message in the blueprint file from Hi from Camel to Hi, again, from Camel. Run mvn deploy, again, and restart the test container. Now the log output should be different.

Last, test releases. Bump the version in the project POM from 1.0.0-SNAPSHOT to 1.0.0. This time a mvn deploy should result in an artifact uploaded to the release repository. Change the version in the example profile to verify that releases are integrated properly.

comments powered by Disqus