Build Profiles

Overview

maven supports multiple profiles . Profiles provide a way for developers to specify different sets of settings and activate a specific set on command. With the gateway, we use profiles to define which modules get built and configuration settings.

Using Build Profiles

The default profile includes all modules and doesn't require any special command line arguments.

  $ mvn clean install

To use a different profile, use maven's -P command line option followed by the profile name.

  $ mvn -P vermont,prod02 clean install

Available State Profiles

Profile Name Description
demo Builds the gateway with demo state settings.
vermont Builds the gateway with Vermont state settings.
xyzzy Builds the gateway with example state settings. (default )

Available Host Profiles

Profile Name Description
prod01 Builds the gateway configured for production server 1.
prod02 Builds the gateway configured for production server 2.
test01 Builds the gateway configured for test server 1.
test02 Builds the gateway configured for test server 2.
dev01 Builds the gateway configured for development server 1.
dev02 Builds the gateway configured for development server 2.
demo Builds the gateway configured for the demo server.
localhost Builds the gateway configured for localhost. (default )

Using gwbuild.bash with profiles

The gwbuild script is needed currently to build the Gateway project with custom profiles. It is located here . This script will run a Maven command for each module in proper order.

Profiles can be enabled simply by adding them as the second argument to gwbuild.bash.

$ bash gwbuild.bash gateway_ear_jboss profile1,profile2

For example, to build an EAR to be run on the dev02 server for the State of Vermont, one would issue the following command:

$ bash gwbuild.bash gateway_ear_jboss vermont,dev02

It is possible to instruct Maven, for each module, to use any profile by the given name defined in that Module's pom. This will allow customization on a per-module basis for State specific needs.

Adding profiles

This section is geared towards adding state and host configuration directories as profile information. This will allow custom configurations to be built into the Gateway using the gwbuild.bash script.

Assuming that you have established at least a new state configuration directory by following this guide . You will want this new directory to be seen by the modules as they are building. This is a fairly simple change that requires adding a new profile to the pom.xml within the gateway module.

<project>
...
        <profiles>
        ...
                <profile>
                        <id>profile-name</id>
                        <activation>
                                <activeByDefault>false</activeByDefault>
                        </activation>
                        <properties>
                                <state>state-code</state>
                        </properties>
                </profile>

Change profile-name to a keyword you will call the profile with, and state-code to the 2-letter state code.

This next example is how to create a profile that will point to a host configuration directory in the config module.

<project>
...
        <profiles>
        ...
                <profile>
                        <id>profile-name</id>
                        <activation>
                                <activeByDefault>false</activeByDefault>
                        </activation>
                        <properties>
                                <host>hostname</host>
                        </properties>
                </profile>

Change profile-name to a keyword you will call the profile with, and hostname to the name of a host directory that resides in config/host/ .