@@ -65,6 +65,18 @@ stages:
6565 echo "Maven is now on the PATH."
6666 mvn --version
6767
68+ - script : |
69+ set -e -x
70+ if ! /usr/libexec/java_home -v 17 >/dev/null 2>&1; then
71+ brew install --cask temurin@17
72+ fi
73+ JAVA_HOME=$(/usr/libexec/java_home -v 17)
74+ echo "JAVA_HOME is set to: $JAVA_HOME"
75+ echo "##vso[task.setvariable variable=JAVA_HOME]$JAVA_HOME"
76+ echo "##vso[task.prependpath]$JAVA_HOME/bin"
77+ displayName: 'Install JDK 17 (macOS)'
78+ condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
79+
6880 - download : build
6981 artifact : ' onnxruntime-java'
7082 displayName : ' Download Final Jar'
@@ -76,9 +88,13 @@ stages:
7688 goals : ' dependency:copy-dependencies'
7789 options : ' -DoutputDirectory=$(Pipeline.Workspace)/build/onnxruntime-java'
7890 publishJUnitTestResults : false
79- javaHomeOption : ' JDKVersion'
80- jdkVersionOption : ' 1.17'
8191 mavenVersionOption : ' Default'
92+ ${{ if eq(parameters.OS, 'MacOS') }} :
93+ javaHomeOption : ' Path'
94+ jdkDirectory : ' $(JAVA_HOME)'
95+ ${{ if eq(parameters.OS, 'Linux') }} :
96+ javaHomeOption : ' JDKVersion'
97+ jdkVersionOption : ' 1.17'
8298
8399 - task : Bash@3
84100 displayName : ' Run Java Tests'
0 commit comments