Sharing Maven Artifacts/Dependencies between plans in Bamboo 5 (OnDemand)

Ok, I thought I had this working, but it turns out I didn't. What I want to know is how do you share Maven artifacts between plans.

Here's my setup:

Project A

  • has a single stage, with a single task, a Maven 3.x task with the goal "clean verify --batch-mode".
  • produces a Maven artifact - projectA.jar. This is not explictly shared by any action on my part.

Project B

  • the top-level pom declares a dependencyManagement on projectA; a submodule has the actual dependency
  • has the "Automatic dependency management" flag enabled on the Dependencies tab
  • has a single stage
    • which has a Maven Dependencies Processor task
    • and a Maven 3.x task with the goal "clean verify --batch-mode"
  • the Maven Dependencies Tab for the project does indeed declare that there is a dependency.

But - when I go to build project B, it doesn't do anything with that dependency. I was expecting it to download the projectA jar (for the appropriate branch), but there's nothing, so the build fails.

I can make it pass by making Project A do an 'install' instead of a 'verify' - but that only passes until the next time the ElasticBamboo restarts. Also, it doesn't work for branches - the install is a "last in wins" approach.

So here's the question:
* Is it possible to automatically share the maven-produced artifacts, without relying on the results of the install task?
* If so, what am I doing wrong with the above?

2 answers

1 accepted

This widget could not be displayed.

It turns out this feature does not exist - the online documentation is in a state of flux where some references to an old deprecated feature still exist.

To quote Marek Went:

Unfortunately, the Maven Dependency management never was meant to provide automatic dependency uploading/installing.

Maven Dependency management is meant for resolve automatic dependencies between plans.

So, it would not provide maven artifacts on your dependent build/job.

The only way to share Maven artefacts between plans is to:

  • publish the artefact (and the pom.xml) from the source project
  • use the Artefact Download task in the destination project to fetch the artefact
  • use a Maven task to invoke 'install:install-file' on the artefact-and-pom
  • then run the normal Maven build

This manual work around will quickly grow out of control if you are using several related Maven projects, and completely defeats the point of automating the plan dependency checks.

If you would like to see real dependency management in Bamboo, then please vote for https://jira.atlassian.com/browse/BAM-13881

This widget could not be displayed.

I did find one thing wrong with the setup - the Maven Dependencies Processor needs to go onto Project A, as a final task, so that Project A knows which dependencies it produces.

Without that step (which I had in my real project, but not in the dummy example), ProjectB doesn't know that the artifact comes from ProjectA. Adding the step allows Bamboo to know the projects are related, and will make it so rebuilding ProjectA will build ProjectB

However, even with that step, ProjectB won't download the dependencies.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Published 4 hours ago in Marketplace Apps

The 7 hacks of highly successful automation

...there's anything I've learnt from working, it's that people are lazy! No offense to anyone reading this, but it's true and we can all admit it. The easier you make something for someone, the more...

26 views 0 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you