I want to upgrade 'java_home' capability in my build agent to jdk8 as this is required to integrate 'Sonarqube Analysis' in my CI build .
How can I update the same in vsts ?
I would like to either change the path for java_home (but that seems uneditable in vsts) to one with jdk8 or upgrade the java under current folder only.
Asked
Active
Viewed 1.3k times
7

Raq
- 433
- 1
- 7
- 20
1 Answers
11
I think, you should update JAVA_HOME environment variable on your CI build machine and restart your build agent. Capabilities will be updated automatically: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops#capabilities
The agent software automatically determines various system capabilities such as the name of the machine, type of operating system, and versions of certain software installed on the machine. Also, environment variables defined in the machine automatically appear in the list of system capabilities.

Shamrai Aleksander
- 13,096
- 3
- 24
- 31
-
Should i update it to "C:\Program Files (x86)\Java\jdk1.8.0_172" , as I need Ci to use jdk 8 ? – Raq Jun 24 '19 at 12:30
-
@RehanHaque yes, if you`ve updated your java environment and that`s your real path on your build machine – Shamrai Aleksander Jun 24 '19 at 15:36
-
same issue is happening with me, how did you solve it? – Mohamad Mousheimish Jan 28 '20 at 10:50
-
2@ShamraiAleksander what about capabilities which do not show up as env variables? – Mansoor Jun 23 '20 at 17:22
-
@ShamraiAleksander for now you can still add your own, i don't know how accurate this is (and it is a couple of years old now) but they were or are thinking about deprecating capabilities: https://github.com/microsoft/azure-pipelines-agent/issues/2291 – Mike Cheel Feb 02 '22 at 18:22
-
I just added some new environment vars on my Win10 machine (using cmd.exe / `setx`) and have restarted the whole machine. Should I expect to see the new vars in the Capabilities screen? I do not – bkwdesign Jul 07 '22 at 18:45
-
I have not been able to trigger it to update those capabilities, specifically the JAVA_HOME variable. I tried stopping and restarting the agent as well as restarting the machine with no luck. I am running the agent interactively on MacOS Monterey. – Just The Highlights Nov 03 '22 at 14:46
-
@JustTheHighlights You can try to add JAVA_HOME through `Add a new capability` here: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/agents?view=azure-devops&tabs=browser#configure-agent-capabilities – Shamrai Aleksander Nov 03 '22 at 14:49
-
Thanks. I was gonna try that but instead, I just decided to remove and reconfigure the agent, which of course sorted it. – Just The Highlights Nov 03 '22 at 16:11