How do one package a maven/artifact with configuration files so a karaf feature can pick it up

Latest response


I want fuse/karaf (7.5 on CENTOS 8) to install my bundles using a feature file. When the feature is installed, I'd like to inctall some configuration files in ${karaf.etc}/etc.

So I have deployed on Nexus:
- an artifact that contains my bundle
- an artifact that contains (in a directpry named config), my configuration files.

I'm deploying all this using this feature file:

<?xml version="1.0" encoding="UTF-8"?>
        xmlns:xsi="" xmlns=""
    <feature name="test-flow" install="auto" version="9.9.9-SNAPSHOT" >
        <bundle start-level="80">mvn:com.sample/flow-11/9.9.9-SNAPSHOT</bundle>
        <configfile finalname="${karaf.etc}/flow-11.cfg" override="false">mvn:com.sample/flow-11/9.9.9-SNAPSHOT/zip/distribution</configfile>

The configuration files are in file and contains

├── config
│   └── flow-11.cfg
├── deploy
│   └── flow11-feature.xml
└── scripts
    └── setup-flow-11-directory-structure

My bundle is in flow-11-9.9.9-SNAPSHOT.jar.

Something is copied, but the resulting ${karaf.etc}/flow-11.cfg file is not readable (it's a binary of some kind).

The file command returns "etc/flow-11.cfg: Zip archive data, at least v2.0 to extract". I've tried to unzip it, but unzip fails to read thios file too.

Here are my questions:
- what format is the artifact referenced in the configfile section supposed to be ?
- how do you produce them using maven ?

Examples would be appriciated.

Thanks for your help.



This documentation may have the answer to your question

I am not sure if it works to zip up your config files and then reference them in your Karaf feature definition. Please try by referencing a plain config file in text format.

Best Regards, Torsten Mielke

Using zip files doesn't work :-( (no surprise here)

I have been reading the documentation you sent me. But what, I can't figure out is what kind of artifact this is:


Do you have a sample pom file that is used to upload such an artifact ?

There is some additional documentation available from the Apache Karaf community documentation, which might also be helpful:

I did read this one as well.

And it turns out that you can use anything that is a valid MVN/PAX url.

My point is that the sample URL used in the RedHat document doesn't conform to the mvn/pax convention !!

The sample URL mvn:org.fusesource.fuseesb.example/configadmin/1.0/cfg, says: - groupid : org.fusesource.fuseesb.example - artifactid : configadmin - version : 1.0 - type: cfg

What is this type 'cfg' ? How do one pack an artifact of that type ?

I have not tried this but believe your config file should end on .cfg when uploaded to Maven.