Page tree

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

Compare with Current View Page History

« Previous Version 10 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

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 with predentials
<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 build profile.

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 build profile.

profile in pom.xml without credentials
    <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 Maven Settings file.

~/.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>

Since the POM is bundled with your artifact, the URL to the test systems is not be revealed, if specified as a property provided with the settings file. This way it is also easier to change the URL for all your projects without the need to update each POM individually.

Deploy to remote Server

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

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).

Resources

Use in App Project
Shows how to add the Apptools Maven Plugin to your Confluence add-on project.
Use in POM Project
Shows how to use the Apptools Maven Plugin in a separate POM project.
Usage
Information on use scenarios of the Apptools Maven Plugin.
  • No labels