Show how to deploy apps with Maven to a Confluence server: app projects and POM projects

Iteration
Finished
Authors
Publisher
Publication Date

Context

  • We have a add-on for Confluence with a collection of macros
  • We design a lot of blueprints (300+) in a number of doctype add-ons (apps, 15+) based on those macros
  • When we deploy a new version of one of our add-ons, we need to deploy it to different environments (DEV plus 3+)

automation required


Use Case 1: Deploy from a Maven App Project

Artifact currently created and located in the target folder.

Deploy to Local Confluence (DEV)
mvn apptools:deploy -PLOCAL
Deploy to Test Enviroment (TEST)
mvn apptools:deploy -PTEST
Deploy to Production (PROD)
mvn apptools:deploy -PPROD
pluginManagement in pom.xml
<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>
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>
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>
~/.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>

Use Case 2: Deploy a Set of Add-ons

Set of apps is defined with the POM.


Deploy latest SNAPSHOTs on Artifact Server to Test Environment
mvn apptools:deploy -PTEST -DuseLatest=SNAPSHOT

Plugin Configuration with Apps
<pluginManagement>
  <plugins>
    <plugin>
      <groupId>de.smartics.maven.plugin</groupId>
      <artifactId>apptools-maven-plugin</artifactId>
      <version>${version.apptools-maven-plugin}</version>
      <configuration>
        <order>
          <item>smartics-projectdoc-confluence$</item>
          <item>extension</item>
          <item>core</item>
        </order>

        <artifacts>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence:obr:${version.toolbox}</gav>

          <gav>de.smartics.atlassian:smartics-projectdoc-bookmarklets-extension:obr:${version.extension.bookmarklets}</gav>
          <gav>de.smartics.atlassian:smartics-projectdoc-graph-extension:obr:${version.extension.graph}</gav>
          <gav>de.smartics.atlassian:smartics-projectdoc-infosys-extension:obr:${version.extension.infosys}</gav>
          <gav>de.smartics.atlassian:smartics-projectdoc-maven-extension:obr:${version.extension.maven}</gav>
          <gav>de.smartics.atlassian:smartics-projectdoc-webapi-extension:obr:${version.extension.webapi}</gav>

          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-core:obr:${version.doctypes.core}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-agileplanning:${version.doctypes.agileplanning}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-app:${version.doctypes.app}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-cfrs:${version.doctypes.cfrs}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-devdiary:obr:${version.doctypes.devdiary}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-impact:${version.doctypes.impact}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-lean:${version.doctypes.lean}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-okrs:${version.doctypes.okrs}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-prjmgmt:${version.doctypes.prjmgmt}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-riskmgmt:${version.doctypes.riskmgmt}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-services:${version.doctypes.services}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-strategy:${version.doctypes.strategy}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-swdev:${version.doctypes.swdev}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-teamwork:${version.doctypes.teamwork}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-doctype-addon-vmodellxt:${version.doctypes.vmodellxt}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-arc42:obr:${version.doctypes.arc42}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-java:obr:${version.doctypes.java}</gav>
          <gav>de.smartics.atlassian.confluence:smartics-projectdoc-confluence-space-maven:obr:${version.doctypes.maven}</gav>
        </artifacts>
      </configuration>
    </plugin>
  ...
  </plugins>
</pluginManagement>

What is next?

  1. Deploy only if not already up-to-date
  2. Check HTTP 500 on bulk deployment

Where can I get ...

... this presentation?


https://www.smartics.de/go/talks