@@ -465,8 +465,9 @@ func DetermineTomcatVersion(raw string) string {
465465
466466// determineTomcatVersion determines the version of the tomcat
467467// based on the JBP_CONFIG_TOMCAT field from manifest.
468- // It looks for a tomcat block with a version of the form "<major>.+" (e.g. "9.+", "10.+").
469- // Returns "<major>.x" (e.g. "9.x", "10.x") so libbuildpack can resolve it,
468+ // It looks for a tomcat block with a version of the form "<major>.+" (e.g. "9.+", "10.+", "10.1.+").
469+ // Returns the pattern with "+" replaced by "*" (e.g. "9.*", "10.*", "10.1.*") so libbuildpack can resolve it.
470+ // Masterminds/semver treats x, X, and * as equivalent wildcards.
470471func determineTomcatVersion (raw string ) string {
471472 raw = strings .TrimSpace (raw )
472473 if raw == "" {
@@ -479,17 +480,9 @@ func determineTomcatVersion(raw string) string {
479480 return ""
480481 }
481482
482- pattern := match [1 ] // e.g. "9.+", "10.+", "10.23.+"
483-
484- // If it's just "<major>.+" (no additional dot), convert to "<major>.x"
485- if ! strings .Contains (strings .TrimSuffix (pattern , ".+" ), "." ) {
486- // "9.+" -> "9.x"
487- major := strings .TrimSuffix (pattern , ".+" )
488- return major + ".x"
489- }
490-
491- // Otherwise, it's something like "10.23.+": pass it through unchanged
492- return pattern
483+ // Replace "+" with "*" so libbuildpack's FindMatchingVersion can resolve it.
484+ // e.g. "9.+" -> "9.*", "10.+" -> "10.*", "10.1.+" -> "10.1.*"
485+ return strings .ReplaceAll (match [1 ], "+" , "*" )
493486}
494487
495488// isAccessLoggingEnabled checks if access logging is enabled in configuration
0 commit comments