Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

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 on Kubernetes

Hi, If you are running self-managed environments and looking to adopt modern infrastructure, Bamboo Data Center can now be deployed in a Kubernetes cluster. By leveraging Kubernetes, you can easily...

958 views 3 8
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