Skip to content

Commit 5d02695

Browse files
author
Madhuri Gummalla
authored
Add Java11 support to all Ant,Maven,Gradle and Xamarin Android tasks (#8736)
1 parent 6c5788f commit 5d02695

File tree

23 files changed

+117
-69
lines changed

23 files changed

+117
-69
lines changed

Tasks/ANTV1/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"loc.input.label.jdkArchitecture": "JDK architecture",
4040
"loc.input.help.jdkArchitecture": "Optionally supply the architecture (x86, x64) of the JDK.",
4141
"loc.messages.LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
42+
"loc.messages.UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
4243
"loc.messages.FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' 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.",
4344
"loc.messages.DiscontinueAntCodeCoverage": "We are discontinuing the support of automated code coverage report generation for Ant projects. Please refer to https://go.microsoft.com/fwlink/?linkid=875306 for more details.",
4445
"loc.messages.NoCodeCoverage": "No code coverage results were found to publish."

Tasks/ANTV1/task.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 141,
20-
"Patch": 2
19+
"Minor": 143,
20+
"Patch": 0
2121
},
2222
"demands": [
2323
"ant"
@@ -209,11 +209,12 @@
209209
"visibleRule": "javaHomeSelection = JDKVersion",
210210
"options": {
211211
"default": "default",
212-
"1.10": "JDK 10",
213-
"1.9": "JDK 9",
212+
"1.11": "JDK 11",
213+
"1.10": "JDK 10 (out of support)",
214+
"1.9": "JDK 9 (out of support)",
214215
"1.8": "JDK 8",
215216
"1.7": "JDK 7",
216-
"1.6": "JDK 6"
217+
"1.6": "JDK 6 (out of support)"
217218
}
218219
},
219220
{
@@ -255,6 +256,7 @@
255256
},
256257
"messages": {
257258
"LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
259+
"UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
258260
"FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' 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.",
259261
"DiscontinueAntCodeCoverage": "We are discontinuing the support of automated code coverage report generation for Ant projects. Please refer to https://go.microsoft.com/fwlink/?linkid=875306 for more details.",
260262
"NoCodeCoverage": "No code coverage results were found to publish."

Tasks/ANTV1/task.loc.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"author": "Microsoft Corporation",
1717
"version": {
1818
"Major": 1,
19-
"Minor": 141,
19+
"Minor": 143,
2020
"Patch": 0
2121
},
2222
"demands": [
@@ -209,11 +209,12 @@
209209
"visibleRule": "javaHomeSelection = JDKVersion",
210210
"options": {
211211
"default": "default",
212-
"1.10": "JDK 10",
213-
"1.9": "JDK 9",
212+
"1.11": "JDK 11",
213+
"1.10": "JDK 10 (out of support)",
214+
"1.9": "JDK 9 (out of support)",
214215
"1.8": "JDK 8",
215216
"1.7": "JDK 7",
216-
"1.6": "JDK 6"
217+
"1.6": "JDK 6 (out of support)"
217218
}
218219
},
219220
{
@@ -255,6 +256,7 @@
255256
},
256257
"messages": {
257258
"LocateJVMBasedOnVersionAndArch": "ms-resource:loc.messages.LocateJVMBasedOnVersionAndArch",
259+
"UnsupportedJdkWarning": "ms-resource:loc.messages.UnsupportedJdkWarning",
258260
"FailedToLocateSpecifiedJVM": "ms-resource:loc.messages.FailedToLocateSpecifiedJVM",
259261
"DiscontinueAntCodeCoverage": "ms-resource:loc.messages.DiscontinueAntCodeCoverage",
260262
"NoCodeCoverage": "ms-resource:loc.messages.NoCodeCoverage"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"loc.messages.LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
3+
"loc.messages.UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
34
"loc.messages.FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' exists and is set to the location of a corresponding JDK or use the [Java Tool Installer](https://docs.microsoft.com/en-us/vsts/build-release/tasks/tool/java-tool-installer) task to install the desired JDK."
45
}

Tasks/Common/java-common/java-common.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ function readJavaHomeFromRegistry(jdkVersion: string, arch: string): string {
3939
export function findJavaHome(jdkVersion: string, jdkArch: string): string {
4040
tl.debug(tl.loc('LocateJVMBasedOnVersionAndArch', jdkVersion, jdkArch));
4141

42-
// jdkVersion should be in the form of 1.7, 1.8, or 1.10
42+
// jdkVersion should be in the form of 1.6, 1.7, 1.8, 1.9, 1.10 or 1.11
43+
// 1.6, 1.9 and 1.10 are out of support
4344
// jdkArchitecture is either x64 or x86
4445
// envName for version 1.7 and x64 would be "JAVA_HOME_7_X64"
4546
var envName = "JAVA_HOME_" + jdkVersion.slice(2) + "_" + jdkArch.toUpperCase();
@@ -50,7 +51,13 @@ export function findJavaHome(jdkVersion: string, jdkArch: string): string {
5051
}
5152

5253
if (!discoveredJavaHome) {
53-
throw new Error(tl.loc('FailedToLocateSpecifiedJVM', envName));
54+
if (jdkVersion === '1.9' || jdkVersion === '1.10') {
55+
// jdk 1.9 and 1.10 are out out support, warn and switch to 1.11 to avoid breaking builds
56+
tl.warning(tl.loc('UnsupportedJdkWarning'));
57+
return findJavaHome('1.11', jdkArch);
58+
} else {
59+
throw new Error(tl.loc('FailedToLocateSpecifiedJVM', envName));
60+
}
5461
}
5562
}
5663

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"messages": {
33
"LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
4+
"UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
45
"FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' exists and is set to the location of a corresponding JDK or use the [Java Tool Installer](https://docs.microsoft.com/en-us/vsts/build-release/tasks/tool/java-tool-installer) task to install the desired JDK."
56
}
67
}

Tasks/GradleV2/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
"loc.messages.codeAnalysisArtifactSummaryTitle": "Code Analysis Results",
8080
"loc.messages.codeAnalysisDisabled": "Code analysis is disabled outside of the build environment. Could not find a value for: %s",
8181
"loc.messages.LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
82+
"loc.messages.UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
8283
"loc.messages.FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' 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.",
8384
"loc.messages.NoCodeCoverage": "No code coverage results were found to publish."
8485
}

Tasks/GradleV2/task.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"author": "Microsoft Corporation",
1616
"version": {
1717
"Major": 2,
18-
"Minor": 141,
19-
"Patch": 1
18+
"Minor": 143,
19+
"Patch": 0
2020
},
2121
"releaseNotes": "Configuration of the SonarQube analysis was moved to the [SonarQube](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarqube) or [SonarCloud](https://marketplace.visualstudio.com/items?itemName=SonarSource.sonarcloud) extensions, in task `Prepare Analysis Configuration`",
2222
"demands": [
@@ -197,11 +197,12 @@
197197
"visibleRule": "javaHomeSelection = JDKVersion",
198198
"options": {
199199
"default": "default",
200-
"1.10": "JDK 10",
201-
"1.9": "JDK 9",
200+
"1.11": "JDK 11",
201+
"1.10": "JDK 10 (out of support)",
202+
"1.9": "JDK 9 (out of support)",
202203
"1.8": "JDK 8",
203204
"1.7": "JDK 7",
204-
"1.6": "JDK 6"
205+
"1.6": "JDK 6 (out of support)"
205206
}
206207
},
207208
{
@@ -359,6 +360,7 @@
359360
"codeAnalysisArtifactSummaryTitle": "Code Analysis Results",
360361
"codeAnalysisDisabled": "Code analysis is disabled outside of the build environment. Could not find a value for: %s",
361362
"LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
363+
"UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
362364
"FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' 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.",
363365
"NoCodeCoverage": "No code coverage results were found to publish."
364366
}

Tasks/GradleV2/task.loc.json

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"author": "Microsoft Corporation",
1616
"version": {
1717
"Major": 2,
18-
"Minor": 141,
18+
"Minor": 143,
1919
"Patch": 0
2020
},
2121
"releaseNotes": "ms-resource:loc.releaseNotes",
@@ -197,11 +197,12 @@
197197
"visibleRule": "javaHomeSelection = JDKVersion",
198198
"options": {
199199
"default": "default",
200-
"1.10": "JDK 10",
201-
"1.9": "JDK 9",
200+
"1.11": "JDK 11",
201+
"1.10": "JDK 10 (out of support)",
202+
"1.9": "JDK 9 (out of support)",
202203
"1.8": "JDK 8",
203204
"1.7": "JDK 7",
204-
"1.6": "JDK 6"
205+
"1.6": "JDK 6 (out of support)"
205206
}
206207
},
207208
{
@@ -359,6 +360,7 @@
359360
"codeAnalysisArtifactSummaryTitle": "ms-resource:loc.messages.codeAnalysisArtifactSummaryTitle",
360361
"codeAnalysisDisabled": "ms-resource:loc.messages.codeAnalysisDisabled",
361362
"LocateJVMBasedOnVersionAndArch": "ms-resource:loc.messages.LocateJVMBasedOnVersionAndArch",
363+
"UnsupportedJdkWarning": "ms-resource:loc.messages.UnsupportedJdkWarning",
362364
"FailedToLocateSpecifiedJVM": "ms-resource:loc.messages.FailedToLocateSpecifiedJVM",
363365
"NoCodeCoverage": "ms-resource:loc.messages.NoCodeCoverage"
364366
}

Tasks/MavenV2/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"loc.messages.codeAnalysisArtifactSummaryTitle": "Code Analysis Results",
8686
"loc.messages.codeAnalysisDisabled": "Code analysis is disabled outside of the build environment. Could not find a value for: %s",
8787
"loc.messages.LocateJVMBasedOnVersionAndArch": "Locate JAVA_HOME for Java %s %s",
88+
"loc.messages.UnsupportedJdkWarning": "JDK 9 and JDK 10 are out of support. Please switch to a later version in your project and pipeline. Attempting to build with JDK 11...",
8889
"loc.messages.FailedToLocateSpecifiedJVM": "Failed to find the specified JDK version. Please ensure the specified JDK version is installed on the agent and the environment variable '%s' 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.",
8990
"loc.messages.NoCodeCoverage": "No code coverage results were found to publish.",
9091
"loc.messages.EntryAlreadyExists": "The settings for the feed or repository already exists in the xml file.",

0 commit comments

Comments
 (0)