- Created by Robert Reiner, last modified on 24. May 2019
Shows how to add the Apptools Maven Plugin to your Confluence add-on project.
The following shows a configuration where the different target environments are configured with the POM file. This makes the different environments immediately accessible to users of the project.
Unfortunately this configuration lacks flexibility in case you administrate more than one project. In this case you may want to check the alternative configuration we show at the end of this tutorial.
Basic Configuration
Simply add the configuration to the POM file of your project.
<build> ... <pluginManagement> <plugins> ... <plugin> <groupId>de.smartics.maven.plugin</groupId> <artifactId>apptools-maven-plugin</artifactId> <version>0.12.0</version> <configuration> <sourceFolder>${basedir}/target</sourceFolder> <includes> <include>${project.artifactId}$</include> </includes> <acceptedFilenameExtensions> <extension>obr</extension> </acceptedFilenameExtensions> </configuration> </plugin> </plugins> </pluginManagement> ... </build>
Use the extension jar
, if your app is not bundled in an OBR.
Configure Servers
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.
The following shows a configuration where the different target environments are configured with the POM file. This makes the different environments immediately accessible to users of the project.
Unfortunately this configuration lacks flexibility in case you administrate more than one project. In this case you may want to check the alternative configuration we show at the end of this document.
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
).
<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
Configure remote Server
In case you want to deploy to a remote test server, add a build profile.
<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.
<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
Alternative Configuration
This configuration has advantages when environments need to be added or removed.
With the configuration explained above you would need to alter the POM file of every project. You can keep this configuration effort local to the settings file if you use the following configuration in your POMs:
<build> ... <pluginManagement> <plugins> ... <plugin> <groupId>de.smartics.maven.plugin</groupId> <artifactId>apptools-maven-plugin</artifactId> <version>0.12.0</version> <configuration> ... <!-- same as above, plus: --> <serverId>${my-project.apptools.remote.server.id}</serverId> <serverUrl>${my-project.apptools.remote.server.url}</serverUrl> </configuration> </plugin> </plugins> </pluginManagement> ... </build>
Then in your settings.xml
add the following as a profile element for each of your environments.
<settings> ... <servers> <server> <id>my-server-id</id> <username>janedoe</username> <password>{swldfcm .... ssdfsdaf323=}</password> </server> </servers> ... <profiles> <profile> <id>MY_ENV_ID</id> <properties> <projectdoc.apptools.remote.server.id>my-server-id</projectdoc.apptools.remote.server.id> <projectdoc.apptools.remote.server.url>https://myserver/confluence</projectdoc.apptools.remote.server.url> </properties> </profile> </profiles> </settings>
Resources
- Usage
- Information on use scenarios of the Apptools Maven Plugin.
- Use in POM Project
- Shows how to use the Apptools Maven Plugin in a separate POM project.