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

Latest response

Hello,

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"?>
<features
        xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0"
        name="test">
    <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>
    </feature>
</features>

The configuration files are in file flow-11-9.9.9-SNAPSHOT-distribution.zip and contains

.
├── config
│   └── flow-11.cfg
├── deploy
│   └── flow11-feature.xml
├── README.md
└── 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.

Responses