Editing a Maven runtime profile

Overview

A Maven runtime profile configures how Maven invokes Apache Camel. A Maven runtime profile stores the Maven goals to execute, any Maven profiles to use, the version of Maven to use, the JRE to use, the classpath to use, any environment variables that need to be set, and a few other pieces of information.

The runtime configuration editor for a Fuse runtime profile contains the following tabs:

  • Main—specifies the name of the new configuration, the fully qualified name of the project's base directory, a few options for locating the base directory, any goals required to execute before running the route, and the version of the Maven runtime to use.

  • JRE—specifies the JRE and command line arguments to use when starting the JVM.

  • Refresh—specifies how Maven refreshes the project's resource files after a run terminates.

  • Environment—specifies any environment variables that need to be set.

  • Common—specifies how the profile is stored and the output displayed.

The first time an Apache Camel route is run using Maven, you must create a default runtime profile for it.

Accessing the Maven runtime configuration editor

  1. In Package Explorer, select the root of the project for which you want to edit or create a custom runtime profile.

  2. Right-click it to open the context menu, and then select Run As... > Run Configurations to open the Run Configurations dialog.

  3. In the context selection pane, select m2 Maven Build, and then click New profile icon at the top, left of the context selection pane.

Figure 10. Runtime configuration editor for Maven

Maven runtime configuration editor

Changing the Maven goal

The most commonly used goal when running a route is camel:run. It loads the routes into a Spring container running in its own JVM.

The Apache Camel plug-in also supports a camel:embedded goal that loads the Spring container into the same JVM used by Maven. The advantage of this is that the routes should bootstrap faster.

If your POM contains other goals, you can change the Maven goal used by clicking the Configure... button next to the Maven Runtime field on the Main tab. On the Installations dialog, you edit the Global settings for <selected_runtime> installation field.

Changing the version of Maven

By default, the Red Hat Fuse IDE developer tools use m2e, which is embedded in Eclipse. If you want to use a different version of Maven or have a newer version installed on your development machine, you can select it by editing the Maven Runtime field on the Main tab.

Changing where the output is sent

By default, the output from the route execution is sent to the Console view. But you can redirect it to a file instead.

To redirect output to a file:

  1. Select the Common tab.

  2. Click the checkbox next to the File: field, and then enter the path to the file where you want to send the output.

    The Workspace..., File System..., and Variables... buttons facilitate building the path to the output file.

Related topics

Running routes using Maven