Hi,
Getting the features plugin working was non-trivial but I eventually managed it.
I had a few bundles I wanted to package up along with the features.xml and dependencies. Within my maven project, I had submodules for my bundles and one more for the 'features' module. It has <packaging>pom</packaging>, so you have to use a few maven plugins to get what you want.
In the src/main/resource folder, I have my features.xml. It looks a bit like this:
<features>
<feature name="my-first-feature" version="${pom.version}">
<bundle>mvn:org.apache.camel/camel-core/1.6.1.2-fuse</bundle>
<bundle>mvn:org.apache.camel/camel-osgi/1.6.1.2-fuse</bundle>
<bundle>mvn:org.blah.me/my-bundle/${pom.version}
.......
</bundle>
</feature>
</features>
For a 'pom' project, you need the maven resource plugin to copy this to your output folder. For that, you need this in your pom.xml:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
....
</plugins>
Then, in order for your features.xml to become an installable/relesable/deployable artifact, use the build-helper plugin. This is what give you more than just pom.xml in your target folder or maven repository.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-artifacts</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/features.xml</file>
<type>xml</type>
<classifier>features</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
Once you have that, you can already add your features URL in Fuse and have it install all the bundles for you (assuming all the dependencies are set up properly)
The next step for me was to create my own repository folder. Installing artifacts in Fuse from my Maven repository was fine for development but not an option for production. I had heard that the recommended best practice was to create a repository folder using the features plugin. It's like the "system" folder in your Fuse installation. It is layed out like a Maven repository but does not require Maven to be installed. This is the bit you need in your XML to have this folder generated when you build the 'features' module:
<plugin>
<groupId>org.apache.felix.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<executions>
<execution>
<id>add-features-to-repo</id>
<phase>generate-resources</phase>
<goals>
<goal>add-features-to-repo</goal>
</goals>
<configuration>
<descriptors>
<descriptor>file:${basedir}/target/classes/features.xml</descriptor>
</descriptors>
<features>
<feature>my-first-feature</feature>
</features>
<repository>target/my-own-repo</repository>
</configuration>
</execution>
</executions>
</plugin>
This takes all the bundles in your features.xml, including third party bundles pulled from your Maven repository, and lays them out in target/my-own-repo.
My final step was to use the assembly plugin to package this up in a tar.gz. I wanted to be able to install fuse, then extract this tar.gz on top of it so that the user could just start servicemix and have everything just 'work'.
So, for completeness, here's the assembly plugin bit:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<id>package</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/assemble/package.xml</descriptor>
</descriptors>
<finalName>${pom.artifactId}-${pom.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>
... and (some of) the assembly descriptor....
<assembly>
<id></id> <!-- intentionally left blank -> http://jira.codehaus.org/browse/MASSEMBLY-301 -->
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>target/my-own-repo</directory>
<outputDirectory>my-own-repo</outputDirectory>
<excludes>
<exclude>
org/apache/camel/**
</exclude>
<exclude>
org/apache/cxf/**
</exclude>
<exclude>org/apache/servicemix/bundles/**</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>target/my-own-repo</directory>
<outputDirectory>system</outputDirectory>
<includes>
<include>org/apache/camel/**</include>
<include>org/apache/cxf/**</include>
<include>org/apache/servicemix/bundles/**</include>
</includes>
</fileSet>
<fileSet>
<directory>target/my-own-repo/</directory>
<outputDirectory>system</outputDirectory>
<includes>
<include>org/apache/camel/**</include>
<include>org/apache/cxf/**</include>
</includes>
</fileSet>
<fileSet>
<!-- Overwrite ServiceMix/Fuse-provided configuration -->
<directory>target/classes/etc</directory>
<outputDirectory>etc</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>deploy</outputDirectory>
<includes> <include>com.oracle.jdbc:ojdbc14</include>
</includes>
</dependencySet>
</dependencySets>
<files>
<file>
<source>${basedir}/target/classes/features.xml</source>
<outputDirectory>my-own-repo/org/test/me/${artifactId}/${version}
</outputDirectory>
<destName>${artifactId}-${version}-features.xml</destName>
<fileMode>0644</fileMode>
<lineEnding>unix</lineEnding>
</file>
</files>
</assembly>
As you can see, I had to put some of thee bundles in the system repository. This prevented version conflicts with the versions provided by fuse. Getting the dependencies right and avoiding conflicts was a long and painful process requiring lots of trial and error. I needed a different version of camel to the default one, and it caused endless headaches. This is the biggest drawback of Fuse and since I can't see any major benefits of using Fuse over plain Felix + the bundles I require, I might just move away from this hassle.
I also had a custom org.apache.servicemix.features.cfg file in my package which overwrites the default one. It has my featuresUrl (mvn:org.test.me/features-package/${pom.version}/xml/features) at the end. I modified to featuresBoot to include my feature and remove some of the default ServiceMix ones.
So, I hope that contains all the info needed to get your feature going. If anyone comes up with any improvements, please let me know! This setup works and gives me something which is easily installed, but it's far from perfect.