Skip to content

Commit be77ef5

Browse files
committed
Avoid always displaying a warning about Java version
While we can't be too strict in the check, we can at least avoid displaying the warning when things look fine.
1 parent bddda4e commit be77ef5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsDeployCommand.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import java.util.List;
1212
import java.util.Optional;
1313
import java.util.concurrent.Callable;
14+
import java.util.regex.Pattern;
1415

1516
import javax.annotation.Nonnull;
1617
import javax.annotation.Nullable;
@@ -79,7 +80,8 @@ public class AzureFunctionsDeployCommand {
7980
"please refer to https://aka.ms/maven_function_configuration#supported-pricing-tiers for valid values";
8081
private static final String EXPANDABLE_REGION_WARNING = "'%s' may not be a valid region, " +
8182
"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`";
8385

8486
protected static final String USING_AZURE_ENVIRONMENT = "Using Azure environment: %s.";
8587

@@ -201,7 +203,8 @@ protected void validateParameters(AzureFunctionsConfig config, String appName) t
201203
throw new BuildException(INVALID_OS);
202204
}
203205
// 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()) {
205208
log.warn(format(EXPANDABLE_JAVA_VERSION_WARNING, config.runtime().javaVersion()));
206209
}
207210
// pricing tier

0 commit comments

Comments
 (0)