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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

JDK capabilities with spaces in name as bamboo variable

If a plan needs to use a specific JDK in a script task, how can I specify it? What works is generic one "java17=${bamboo.capability.system.jdk.JDK}". Say we'd like to use 1.7.025. So far tried:

java17=${bamboo.capability.system.jdk.JDK 1.7.0_25}

java17=${bamboo.capability.system.jdk.JDK\ 1.7.0_25}

java17=${"bamboo.capability.system.jdk.JDK 1.7.0_25"}

None worked :(

4 answers

1 accepted

1 vote
Answer accepted

We recommend that you do not use capability labels with space characters, if you wish to use them as variables. A possible solution for space characters is to format them with '${}' symbols, however, this does not work in all cases.

https://confluence.atlassian.com/display/BAMBOO/Bamboo+variables#Bamboovariables-Specifyingcapabilitiesasvariables

JDKs apparently are autodiscovered and so labels are auto-created. I am hesitant to make changes to all of them (currently about 15 different JDKs in our bamboo). But I found this this works just fine:

java17="${bamboo.capability.system.jdk.JDK 1.7.0_25}"

Since this format is in line with your answer I am going to accept it.

I think it would be really nice if the JDK dropdown was available on script tasks. Since Gradle isn't supported out of the box, the only way to run a Gradle build it by using the script task, not having a JDK dropdown available just makes choosing your own JDK much more complex than it should be.

I am hitting the same issue, JDK 1.8, the capability key looks like this:

system.jdk.JDK+1.8

and I do not know how to get rid from the "+"

Oups, apparently I have to remove the "+" from

${bamboo.capability.system.jdk.JDK+1.8}

which yields

${bamboo.capability.system.jdk.JDK 1.8}

The corresponding environment variable also works (that is printed in the logs) for the sh scripts

$bamboo_capability_system_jdk_JDK_1_8

 

 

Are these variables something I can use inline in the build plan task?  I tried to use java17="${bamboo.capability.system.jdk.JDK 1.7.0_25}" in the inline script, but it throws an invalid substitution error.

See my answer in the same thread: "

${bamboo.capability.system.jdk.JDK 1.8}" works for me, as well as the environment variable "$bamboo_capability_system_jdk_JDK_1_8"

Suggest an answer

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

Bamboo 7.1 is here and is packed with value!

I'm happy to announce that Bamboo 7.1 has been released and it’s overflowing with awesome new features. Top-voted issues First and foremost, a bunch of JAC top voted issues has been delivered - y...

974 views 4 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