Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bamboo Specs and the reuse of tasks

Hi there,

I'm starting right now to switch from manuelly clicked Build Plans and Deployment Projects to Bamboo Specs.

Especially for the Deployment Projects I have often:

  • multiple environments
  • same tasks for each environment
  • different variable values

Im wondering, if there is any best practise to make the "tasks" reusable because I don't expect that it is the right approach to code the same list of tasks for every environment.

Thanks for given me an hint.




1 answer

1 accepted

1 vote
Answer accepted

Depending of your language of choice Java or YAML it will be different

If we talk about Java, put your tasks to some array and then reuse it

If you plan to use YAML, it has some limitation on repetitive elements usage, but look at

Hey Alexey,
thanks for you quick answer.

We plan to use Java to avoid any limitation.

Can you please provide a small nippet as an example?



private static MavenTask maven3Task(String label) {
return new MavenTask()

public Plan plan() {
return new Plan(new Project().key("Test")).stages(new Stage("Default stage")
.jobs(new Job("Default job", "JOB1").tasks(
maven3Task("Maven 3.0").goal("clean install"),

Hey Alexey,
I'm very sorry, but I don't "understand" your solution snippet :/

As an example, the deployment has following tasks

  • ScriptTask() "Stop Service"
  • ScriptTask() "Stop Website"
  • ScriptTask() "Deploy Backend"
  • ScriptTask() "Start Service"
  • ScriptTask() "Start Website"

These 5 tasks belong togehter and need to happen on each of the environments.

Please suggest, thanks.


Deployment deployment = new Deployment(new PlanIdentifier("TEST", "TEST"), "My deployment");
Task[] tasks = new Task[] {
new ScriptTask().description("Stop Service").inlineBody("echo 'stop service'"),
new ScriptTask().description("Stop Website").inlineBody("echo 'stop Website'"),
new ScriptTask().description("Deploy Backend").inlineBody("echo 'Deploy Backend'"),
new ScriptTask().description("Start Service").inlineBody("echo 'Start Service'"),
new ScriptTask().description("Start Website").inlineBody("echo 'Start Website'"),

new Environment("Env 1").tasks(tasks),
new Environment("Env 3").tasks(tasks)

And Bamboo says:

cannot find symbol [ERROR]   symbol:   class Task

You need to have 


 at the top of your class, next to other imports like ScriptTask, Deployment, PlanIdentifier etc

Like Steffen Opel _Utoolity_ likes this

Thanks a lot, that worked now.

For any reason, the IntelliJ has stopped intellisense and import suggestion.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bamboo

Bamboo Data Center - Early Access Program 2

We’re preparing for Bamboo 8.0, which will be our first Data Center release. To make sure our app vendors and customers with written in-house apps are prepared, we’re launching Bamboo 8.0 Early Acces...

81 views 0 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you