I am running my job on a specific agent and using below commands
- script: |
java -version
env:
JAVA_HOME: $(JAVA_HOME_11_X64)
PATH: $(JAVA_HOME_11_X64)/bin:$(PATH)
Output
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.18.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.18.04, mixed mode, sharing)
But when the maven command runs it doesn't find java so what exactly should I pass here. openjdk 11.0.11 is present on agent and how to pass this in maven? I tried passing 1.8 and 11.0.11 but it given error for that too. How to solve this and what exactly should I pass here in maven task?
- task: Maven@3
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '11'
jdkArchitectureOption: 'x64'
Output
##[error]Unhandled: Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable 'JAVA_HOME_11_X64' exists and is set to the location of a corresponding JDK or use the [Java Tool Installer](https://go.microsoft.com/fwlink/?linkid=875287) task to install the desired JDK.
Finishing: Maven