How do I configure an elastic agent to use Java 7 only

I'm running Bamboo OnDemand and by default, it tries to compile with Java 8. The odd thing is under the agent configuration, capabilities, JDK8 isn't even listed. Just 5, 6 and 7.

Anyway, I've got a plan that checks out the project from Git and tries to build it using gradlew. The compilation files because it's using JDK8. So how do I configure the agent to use specifically JDK7.

Thanks.

3 answers

1 accepted

Thanks Rafael.

I ended up going with a different solution. Since I'm already using EBS to customize my elastic instance, I just added the following lines to the file /mnt/bamboo-ebs/profile-extras.sh before making my snapshot.

 

export JAVA_HOME=/opt/jdk-7
export PATH=$PATH:$JAVA_HOME/bin

This seems to have solved my problem.

0 vote

Hello Michael,

Thank you for your question.

Have you attempted on setting up the path to JDK?

compile.options.fork=true;
compile.options.forkOptions.executable='path/to/javac'

If you find this answer useful, I would kindly ask you to accept it so the same will be visible to others who might be facing the same issue you have inquired.

Thank you for your understanding.

Kind regards,
Rafael P. Sperafico
Atlassian Support

That requires me to change the gradle build file and to hardcode a path to javac. That type of info shouldn't be hardcoded in the build file in my opinion as it makes it harder to build in other environments (i.e. develop machines).

0 vote

Hello Michael,

I haven't tested but you could try and create a plan variable by providing the path to the Java version you want to use and add this variable to your build file.

Please, refer to Bamboo variables documentation for further information.

Otherwise, it would be required to run an elastic agent and downgrade the java version used to run Bamboo, which is not recommended.

Those are the options you have.

Kind regards,
Rafael P. Sperafico
Atlassian Support

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Renan Battaglin
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,368 views 0 5
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