Bamboo Stages and the Maven Lifecycle

Philipp Paland January 18, 2012

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

5 votes
Answer accepted
Heather Wells January 18, 2012

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.

Peter Kahn
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 25, 2014

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
TAGS
AUG Leaders

Atlassian Community Events