How to install multiple versions of the same executable on a Bamboo Data Center Agent

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

This article explains how to install different versions of Maven in a Bamboo Agent and how to configure the Bamboo Data Center to execute each of those versions.

This same procedure could apply for different executables such as NPM for example.

Environment

  • Bamboo Data Center 9.6.8 but the solution would be applicable for any other supported version.

  • Bamboo Agents (Linux) but with slight changes it also applies to Windows

Solution

Let's breakdown the installation and configuration in two parts, as for example we are going to use Ubuntu as our OS for the Bamboo Agents.

Part 1: Installing multiple Maven versions on Ubuntu

Step 1: Download Maven Versions

  1. Visit the Apache Maven Download Page.

  2. Download the binary tar.gz archives for the Maven versions you require. For example, Maven 3.6.3 and Maven 3.8.1.

Step 2: Extract Maven Archives

  1. Open a terminal.

  2. Navigate to the directory where you downloaded the Maven archives.

  3. Use the tar command to extract each archive to /opt. You might need sudo permissions to do this.

1 sudo tar -xvzf apache-maven-3.6.3-bin.tar.gz -C /opt
1 sudo tar -xvzf apache-maven-3.8.1-bin.tar.gz -C /opt

Step 3: Verify Installation

Verify that Maven is correctly installed by running the version command for each installation:

1 /opt/apache-maven-3.6.3/bin/mvn -version
1 /opt/apache-maven-3.8.1/bin/mvn -version

This will display the version of Maven installed, confirming the successful installation.

ℹ️ Now that you have both Maven versions extracted, you can execute Maven commands directly using the version-specific bin folder (This will help you to discard any installation issue unrelated to Bamboo).

  1. Open a Terminal: You can do this by searching for "Terminal" in your applications menu.

  2. Navigate to Your Project Directory: Use the cd command to change to the directory containing the project you want to build or work on. For example:

1 cd /path/to/your/project

3. Execute Maven from a Specific Version's Bin Directory: Now, you can run Maven commands by specifying the full path to the Maven executable in the bin directory of the version you want to use.

For example, to use Maven 3.6.3 installed in /opt:

1 /opt/apache-maven-3.6.3/bin/mvn clean install

Or, to use Maven 3.8.1:

1 /opt/apache-maven-3.8.1/bin/mvn clean install

Replace clean install with whatever Maven goals or phases you need to execute for your project.

⚠️ Once you have tested that each Maven version works as expected, please continue configuring the capabilities for Bamboo Data Center.

Part 2: Configuring Bamboo Data Center to use multiple Maven versions

Step 1: Add Maven Executables as Capabilities in Bamboo

  1. Log in to your Bamboo instance as an admin.

  2. Navigate to Bamboo Administration > Agents.

  3. Click on the agent where you installed the Maven versions.

  4. In the agent's detail page, find the Capabilities section and click on Add Capability.

  5. For Type, select Executable.

  6. In the Capability label field, enter a meaningful name for the Maven version, e.g., "Maven 3.6.3" or "Maven 3.8.1".

  7. In the Path field, enter the full path to the mvn executable for the Maven version. For example:

    • For Maven 3.6.3: /opt/apache-maven-3.6.3/bin/mvn

    • For Maven 3.8.1: /opt/apache-maven-3.8.1/bin/mvn

  8. Click Add to save the new capability.

💡 Repeat these steps to add other Maven versions as separate capabilities, ensuring each has a unique Capability label.

Step 2: Configure Your Build Plan to Use the Specific Maven Version

  1. Navigate to the plan you want to configure and click on Actions > Configure Plan.

  2. Go to the Tasks tab and either edit an existing Maven task or click on Add task to create a new one.

  3. While configuring the Maven task, look for the Executable dropdown. This dropdown lists all the executables that Bamboo recognizes, including the Maven capabilities you've added.

  4. From the Executable dropdown, select the Maven version you want to use for this build plan, based on the capability labels you've defined (e.g., "Maven 3.6.3" or "Maven 3.8.1").

  5. Save the Task: After selecting the desired Maven version, configure any additional settings for your Maven task as needed, such as goals, options, or advanced options. Once you're done, click Save for the task.

  6. Save the Plan Configuration: Make sure to save any changes to your build plan configuration to ensure the updates are applied.

Updated on April 24, 2025

Still need help?

The Atlassian Community is here for you.