Bamboo Stages and the Maven Lifecycle

Note: I have also posted this Question on StackOverflow, but haven't got any answers so far. I thought it might be beneficial to ask here.

Let's say I have a pretty standard maven based java project that uses almost all of the maven lifecycle. Compile on compile, JUnit test cases on test, integration testing using an automatically started and stopped jetty on integration-test / verify, deploying to our internal maven repo on deploy. Basic stuff.

This also runs as a build plan on our Bamboo server. At the moment, there is only one stage with one job with one task, that executes mvn clean deploy. This ensures that the SNAPSHOT on our repo is always the last version from source control that compiles without test failures.

Now, my feeling is that Bamboo could do more... What are all the stages and tasks and stuff for, if everything is handled in one lonely task? So I thought, maybe the could be a "test" stage, an "integration-test" stage and a "deployment" stage that execute mvn test, mvn verify and mvn deploy... But: Every Stage has it's own checkout directory and as such, the last stage has to do the whole maven lifecycle up to deploy again, including test and verify...

What would be a good way to map maven to bamboo? I didn't find any example configurations like this. Has anyone done this before in a coherent way? Or should I move testing stuff from the pom.xml to directly configured Bamboo jobs?

1 answer

1 accepted

This widget could not be displayed.

I have a similar setup. My solution isn't ideal but it's working for now. I have several stages, Compile + Unit Test, Integration Test + SNAPSHOT deploy, Maven Release, etc. I created a shared artifact of the entire workspace from the first stage and then a dependency on that artifact for the subsequent stage Since the target directories with the compiled classes are preserved, Maven shouldn't have to compile them all over again. Of course, there's no way to tell Maven to skip earlier phases, so it does run them all, but it does skip recompiling unchanged code.

I've set up the stages this way so that developers get feedback as early as possible (as soon as the unit tests are complete) rather than having to wait for the lengthier integration tests and deployments to complete.

My guess is that the "intent" of Bamboo is that the tests would be run in subsequent stages outside of maven, but since we already have everything configured to work in maven I've been reluctant to configure running the tests separately.

Sharing the entire workspace seems like overkill, but I don't see how it's any worse than checking out from source for each stage and recompiling.

I'm definitely open to other solutions if anyone has a configuration to share.

Heather, how's performance in unpacking that while workspace shared artifact? Is it roughly equivalent to source control checkout? And how big a workspace do you have. Mine is around 20g built. So I planned to just pack up classes and test classes for moving out to other jobs

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 7 hours ago in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

36 views 0 5
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