bamboo java specs with extra maven repository

603 Views Asked by At

I use bamboo 7.2.2 as a CI engine with java specs. I am trying to build some reusable bamboo stages/jobs/tasks. Develop once, publish to a private maven repository, and then reuse them in various other bamboo plans by defining the dependency in the pom.xml.

As the library is published in a private repository, I have to define the repository in the pom.xml.

The problem is that at runtime, bamboo merges my pom.xml with some template of its own and removes the repository definition.

Is there any other option to define multiple maven repositories for bamboo java specs?

2

There are 2 best solutions below

0
On

We do exactly what you describe and don't appear to have any problems. We're able to use our custom shared classes in our Bamboo Specs. This is the pom.xml for one of our apps.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.atlassian.bamboo</groupId>
    <artifactId>bamboo-specs-parent</artifactId>
    <version>7.2.3</version>
    <relativePath />
  </parent>

  <groupId>com.example.someapp</groupId>
  <artifactId>bamboo-specs</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>

  <repositories>
    <repository>
      <id>nexus</id>
      <name>Internal Nexus Repository</name>
      <url>https://mvn.example.com/nexus/content/groups/public</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.example</groupId>
      <artifactId>custom-bamboo-specs</artifactId>
      <version>2.4</version>
    </dependency>
  </dependencies>
</project>

The only weird behaviour we have is that we can't have two apps building with different versions of this custom library - Bamboo gets really confused until we bring them all in line. Other than that, it works.

Bamboo version: 7.2.10

0
On

No way other than modifying the template pom.xml on the Bamboo server.

Note however, that you'll have to wait for 24 hours (the Maven default) to see your changes in the common specs library. Unless of course, you bump the common specs version and manually update the template pom.xml again.