Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

Shows how to configure servers as profiles. This makes it easy to select a deployment target by selecting a profile.

Type
Level of Experience

Description

We recommend the practice of configuring different environments in build profiles as part of the Maven POM file.

Per convention we use all-uppercase identifiers for profiles that contain environments. The Apptools Maven Plugin is able to recognize environment profiles with this convention.

This is a short tutorial on how environment configurations can be stored with build profiles.

Configure local Server

Add build profiles to configure the Confluence servers you want to deploy to.

The following shows the deployment to the locally started Confluence on a developer machine (with default password and user admin).

profile in pom.xml
<profiles>
  <profile>
    <id>LOCAL</id>
    <activation>
      <activeByDefault />
    </activation>
    <build>
      <pluginManagement>
        <plugins>
          <plugin>
            <groupId>de.smartics.maven.plugin</groupId>
            <artifactId>apptools-maven-plugin</artifactId>
            <configuration>
              <username>admin</username>
              <password>admin</password>
              <serverUrl>http://localhost:1990/confluence</serverUrl>
            </configuration>
          </plugin>
        </plugins>
      </pluginManagement>
    </build>
  </profile>
  ...
</profiles>

Deploy the OSGi Bundle Repository (OBR) artifact to the local server by specifying the profile like this.

mvn apptools:deploy -PLOCAL

-P activates a Build Profile

 

The chapter Maven Command Line Options, part of the online book Maven: The Complete Reference, provides detailed information about the command line options.

It includes the option -P which activates a build profile by its identifer (specified by the id element in the POM or elsewhere – see Introduction to Build Profiles for details).

Configure remote Server

In case you want to deploy to a remote test server, add a profile like this:

profile in pom.xml
    <profile>
      <id>TEST</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>de.smartics.maven.plugin</groupId>
              <artifactId>apptools-maven-plugin</artifactId>
              <configuration>
                <serverId>confluence-test</serverId>
                <serverUrl>${my.server.url.TEST}</serverUrl>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

Provide the credentials and the uniform resource locator (URL) to access the TEST server in your settings.xml.

~/.m2/settings.xml
<settings>
  ...
  <servers>
    ...
    <server>
      <id>confluence-test</id>
      <username>jane.doe</username>
      <password>{HllO1A....}</password>
    </server>
  </servers>
...
  <profiles>
    <profile>
        <my.server.url.TEST>https://www.mycorp.example.com/confluence</my.server.url.TEST>
      </properties>
    </profile>
    ...
  </profiles>
</settings>

Configure local Server

Deploy the OBR artifact to the remote test server by specifying the profile like this.

mvn apptools:deploy -PTEST

-P activates a Build Profile

 

The chapter Maven Command Line Options, part of the online book Maven: The Complete Reference, provides detailed information about the command line options.

It includes the option -P which activates a build profile by its identifer (specified by the id element in the POM or elsewhere – see Introduction to Build Profiles for details).

  • No labels