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.

http://stackoverflow.com/questions/8819409/bamboo-stages-and-the-maven-lifecycle

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

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
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published 18 hours ago in Off-topic

Get to know our Atlassian User Group Leaders from Bengaluru, India

Meet @Dinesh Dhinakaran, @Vishnu Vasudeva, @Rajeev Verma, and Jamshid Nalakath: Our extraordinary AUG leaders from Bengaluru, India. These four work together to strengthen the bonds of their local co...

127 views 0 4
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