Goal features:generate

The features:generate goal generates a features XML file for every bundle listed in the project's dependencies. In order to satisfy the required imports in these bundles, the plugin will add bundles:

  • bundles provided by Apache Karaf

  • a explicit list of bundles

  • bundles discovered in the POM's transitive dependencies

Afterwards, the generated file will be attached to the build as an additional build artifact (by default as group:artifact:version:xml:features).

Example

The example below generates one feature that installs bundle mvn:org.apache:bundle1:1.0 in a features XML file called target/features.xml. It will find bundle in Apache Karaf 2.2.4, the transitive dependencies for this POM and the bundles listed in src/main/resources/bundles.properties.

<project>
  <dependencies>
    <dependency>
      <groupId>org.apache</groupId>
      <artifactId>bundle1</artifactId>
      <version>1.0</version>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <version>2.2.4</version>
          <executions>
            <execution>
              <id>generate</id>
              <phase>generate-resources</phase>
              <goals>
                <goal>generate</goal>
              </goals>
              <configuration>
                <bundles>src/main/resources/bundles.properties</bundles>
                <kernelVersion>2.2.4</kernelVersion>
                <outputFile>target/features.xml</outputFile>
              </configuration>
            </execution>
          </executions>
        </plugin>
    </plugins>
  </build>  
</project>

Parameters

Name Type Description
outputFile File Name of the features XML file that is being generated
Default value: /x1/asf/karaf-2.2.x/target/checkout/manual/target/classes/feature.xml
attachmentArtifactType String The artifact type for attaching the generated file to the project
Default value: {{xml})
attachmentArtifactClassifier String The artifact classifier for attaching the generated file to the project
Default value: features
kernelVersion String The version of Karaf that is used to determine system bundles and default provided features
bundles File A properties file that contains a list of bundles that will be used to generate the features.xml file