Red Hat Training

A Red Hat training course is available for Red Hat Fuse

7.3. Configuring the Plug-In

Specifying profile information

You can explicitly configure the name of the profile to create, by adding a configuration element to the plug-in configuration in your pom.xml file, as follows:
<plugins>
  <plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>fabric8-maven-plugin</artifactId>
    <configuration>
      <profile>my-thing</profile>
    </configuration>
  </plugin>
</plugins>

Multi-module Maven projects

For multi-module Maven projects, a more flexible way to configure the plug-in is to use Maven properties. For example if you have a multi-module maven project such as this:
pom.xml
foo/
  pom.xml
  a/pom.xml
  b/pom.xml
  ...
bar/
  pom.xml
  c/pom.xml
  d/pom.xml
  ...
You could define the plug-in once in the root pom.xml file, as follows:
<plugins>
  <plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>fabric8-maven-plugin</artifactId>
  </plugin>
</plugins>
While in the foo/pom.xml file you need only define the fabric8.profile property, as follows:
<project>
  ...
  <properties>
    <fabric8.profile>my-foo</fabric8.profile>
    ...
  </properties>
  ...
</project>
All of the projects within the foo folder, such as foo/a and foo/b, will deploy to the same profile (in this case the profile, my-foo). You can use the same approach to put all of the projects under the bar folder into a different profile too.
At any point in your tree of maven projects you can define a maven fabric8.profile property to specify exactly where it gets deployed; along with any other property on the plug-in (see the Property Reference below).

Specifying features, additional bundles, repositories and parent profiles

You can specify additional configuration in the maven plug-in, as follows:
<plugins>
  <plugin>
    <groupId>io.fabric8</groupId>
    <artifactId>fabric8-maven-plugin</artifactId>
    <configuration>
      <profile>my-rest</profile>
      <features>fabric-cxf-registry fabric-cxf cxf war swagger</features>
      <featureRepos>mvn:org.apache.cxf.karaf/apache-cxf/${version:cxf}/xml/features</featureRepos>
    </configuration>
  </plugin>
</plugins>
Note that the features element allows you to specify a space-separated list of features to include in the profile.
This example specifies space-separated lists for the parent profile IDs, features, repositories and bundles so that it is easy to reuse Maven properties for these values (for example, to add some extra features to a child maven project while inheriting from the parent project).

Configuring with Maven properties

You can also use maven property values (or command line arguments) to specify the configuration values by prefixing the property name with fabric8.. For example, to deploy a maven project to the cheese profile name, enter the command:
mvn fabric8:deploy -Dfabric8.profile=cheese
By default, the project artifacts are uploaded to the Maven repository inside the fabric. If you want to disable this beahvior and just update the profile configuration (for example, if you are already pointing your fabric's Maven repository to your local Maven repository), you can set fabric8.upload=false—for example:
mvn fabric8:deploy -Dfabric8.upload=false

Specifying profile resources

If you create the directory, src/main/fabric8, in your Maven project and add any resource files or a ReadMe.md file to your project, they will automatically be uploaded into the profile as well. For example, if you run the following commands from your Maven project directory:
mkdir -p src/main/fabric8
echo "## Hello World" >> src/main/fabric8/ReadMe.md
mvn fabric8:deploy
The newly deployed profile will include a ReadMe.md wiki page.