Last updated Apr 25, 2024

Setting the platform version dependency in the POM

It can be cumbersome to update version numbers of platform modules whenever you need to update to a new version of the Atlassian Platform Common Components.

To avoid this, you can have just one version to maintain by using the atlassian-platform-libraries and atlassian-platform-plugins POM artifacts to set the versions via Maven's import scope. This allows you to change the platform version and have all the appropriate versions of platform modules set automatically.

For your web application, add this to your dependencyManagement section:

1
2
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.refapp</groupId>
            <artifactId>atlassian-platform-libraries</artifactId>
            <version>2.7.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

For your bundled plugins module that builds the bundled plugins archive, add this:

1
2
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.atlassian.refapp</groupId>
            <artifactId>atlassian-platform-plugins</artifactId>
            <version>2.7.0</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

With these elements in place, you can now remove the version elements for all platform libraries and plugins.

For consistency, we recommend that you use a Maven property for the version to allow easy overriding: platform.version

If you are depending on a project that contains the above dependencyManagement stanza, you may receive an error similar to:

1
2
[INFO] Unable to find resource 'com.atlassian.refapp:atlassian-platform-libraries:pom:2.7.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.atlassian.refapp:atlassian-platform-libraries
Reason: POM 'com.atlassian.refapp:atlassian-platform-libraries' not found in repository: Unable to download the artifact from any repository
  com.atlassian.refapp:atlassian-platform-libraries:pom:2.7.0
from the specified remote repositories:
  central (http://repo1.maven.org/maven2)
for project com.atlassian.refapp:atlassian-platform-libraries
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------

This is due to a bug (MNG-4148) in Maven 2.x where profiles specified in settings.xml are ignored.

Apart from upgrading to Maven 3.x, there is currently no workaround for this.

Note that this does not affect projects that have the above dependencyManagement in their POM. For example, if project A has the stanza, it will build successfully. However, if project B depends on project A, it will cause the error mentioned above.

Atlassian Platform Common Components Plugin Framework 2.6 Migration Guide

Rate this page: