Version of your agent? Hosted
Current agent version: '2.112.0'
OS of the machine running the agent? Windows
VisualStudio.com
http://universalplatform.visualstudio.com
I need to specify the JDK directory for my build, i look at the JDK on capabilities and it shows
C:\Program Files\Java\jdk1.8.0_40
But that's not the actually path for the jdk 1.8 installed on the machine..
If i run a dir of Java folder i get:
2017-03-08T19:09:53.0366026Z Task : Command Line
2017-03-08T19:09:53.0366026Z Description : Run a command line with arguments
2017-03-08T19:09:53.0366026Z Version : 1.1.2
2017-03-08T19:09:53.0366026Z Author : Microsoft Corporation
2017-03-08T19:09:53.0376023Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2017-03-08T19:09:53.0376023Z ==============================================================================
2017-03-08T19:09:53.0406023Z ##[command]dir "C:\Program Files\Java\"
2017-03-08T19:09:53.0536056Z Volume in drive C has no label.
2017-03-08T19:09:53.0536056Z Volume Serial Number is 78C2-210A
2017-03-08T19:09:53.0536056Z
2017-03-08T19:09:53.0536056Z Directory of C:\Program Files\Java
2017-03-08T19:09:53.0536056Z
2017-03-08T19:09:53.0606019Z 12/02/2016 02:25 AM <DIR> .
2017-03-08T19:09:53.0606019Z 12/02/2016 02:25 AM <DIR> ..
2017-03-08T19:09:53.0606019Z 12/02/2016 02:25 AM <DIR> jdk1.6.0_45
2017-03-08T19:09:53.0606019Z 12/02/2016 02:24 AM <DIR> jdk1.7.0_75
2017-03-08T19:09:53.0606019Z 12/02/2016 02:23 AM <DIR> jdk1.8.0_102
2017-03-08T19:09:53.0606019Z 12/02/2016 02:23 AM <DIR> jre1.8.0_102
2017-03-08T19:09:53.0606019Z 12/02/2016 02:25 AM <DIR> jre6
2017-03-08T19:09:53.0606019Z 12/02/2016 02:24 AM <DIR> jre7
@rmarinho
base on https://github.com/Microsoft/vsts-agent/blob/master/src/Misc/layoutbin/powershell/Add-JavaCapabilities.ps1
Add-CapabilityFromRegistry -Name 'jdk_8_x64' -Hive 'LocalMachine' -View 'Registry64' -KeyName $jdk8KeyName -ValueName 'JavaHome' -Value ([ref]$latestJdk)
We are reading from your registry
LocalMachine\Software\JavaSoft\Java Development Kit\1.8\JavaHome
Can you check it?
how do i check the registry on a remote machine? remember this is the hosted agent
@rmarinho sorry, didn't realize it's hosted.
@thechrisjohnson how do we install Java SDK on Hosted image?
Also the "java" capability is missing in Hosted 2017 agents, it was there in the old Hosted agents. When I try to use the SonarQube tasks from the Marketplace they are failing on Hosted 2017 agents because Java is missing. Don't know if fixing the JDK path is sufficient. Perhaps also the "java" capability needs to be added.
Can somebody confirm that this is a bug and needs to be fixed? We are currently blocked a bit because we cannot run our static code analysis in CI. Don't want to setup private agents for that now.
@madhurig @thechrisjohnson
Is the Java installed on VS2017 Hosted Image? do we have plan to fix it?
pinging offline for an update
@SnoopyCoder you can add a user capability to enable routing to the agent
@rmarinho as a workaround you can use powershell to check the registry values on the hosted agent
The hosted vs 2017 was updated and should have rolled out everywhere now.
I'm somewhat lost on the current state of the issue. Is this resolved? Or is there any remaining problem (e.g. incorrect capabilities)?
AFAIK the "java" capability is still missing. When trying yo use the SonarQube extension on Hosted VS2017 it fails with:
No agent found in pool Hosted VS2017 which satisfies the specified demands:
msbuild
java
DotNetFramework
visualstudio
vstest
Agent.Version -gtVersion 1.102
@thechrisjohnson @madhurig
@henryju thanks for the update (as a workaround you can add as a user capability)
@ericsciple thanks for the workaround, that work fine. We'll document that to our users, but it would be great to have the capability added out of the box.
Agreed. @thechrisjohnson is working on updating the capabilities on the VS2017 agent. Also I believe we have some work in progress that will keep the capabilities up to date and accurate in the future (right now it's a static list).
A fix for this was pushed on Friday, we're just waiting on our deployment to go out to all Scale Units.
Most helpful comment
@madhurig @thechrisjohnson
Is the Java installed on VS2017 Hosted Image? do we have plan to fix it?