|
11 | 11 | import java.util.List; |
12 | 12 | import java.util.Optional; |
13 | 13 | import java.util.concurrent.Callable; |
| 14 | +import java.util.regex.Pattern; |
14 | 15 |
|
15 | 16 | import javax.annotation.Nonnull; |
16 | 17 | import javax.annotation.Nullable; |
@@ -79,7 +80,8 @@ public class AzureFunctionsDeployCommand { |
79 | 80 | "please refer to https://aka.ms/maven_function_configuration#supported-pricing-tiers for valid values"; |
80 | 81 | private static final String EXPANDABLE_REGION_WARNING = "'%s' may not be a valid region, " + |
81 | 82 | "please refer to https://aka.ms/maven_function_configuration#supported-regions for valid values"; |
82 | | - private static final String EXPANDABLE_JAVA_VERSION_WARNING = "'%s' may not be a valid java version, recommended values are `Java 17` and `Java 21`"; |
| 83 | + private static final Pattern JAVA_VERSION_PATTERN = Pattern.compile("(java )?[0-9]+", Pattern.CASE_INSENSITIVE); |
| 84 | + private static final String EXPANDABLE_JAVA_VERSION_WARNING = "'%s' may not be a valid java version, recommended values are `17` or `21`"; |
83 | 85 |
|
84 | 86 | protected static final String USING_AZURE_ENVIRONMENT = "Using Azure environment: %s."; |
85 | 87 |
|
@@ -201,7 +203,8 @@ protected void validateParameters(AzureFunctionsConfig config, String appName) t |
201 | 203 | throw new BuildException(INVALID_OS); |
202 | 204 | } |
203 | 205 | // java version |
204 | | - if (StringUtils.isNotEmpty(config.runtime().javaVersion())) { |
| 206 | + if (StringUtils.isNotEmpty(config.runtime().javaVersion()) |
| 207 | + && !JAVA_VERSION_PATTERN.matcher(config.runtime().javaVersion()).matches()) { |
205 | 208 | log.warn(format(EXPANDABLE_JAVA_VERSION_WARNING, config.runtime().javaVersion())); |
206 | 209 | } |
207 | 210 | // pricing tier |
|
0 commit comments