diff --git a/internal/java/plan.go b/internal/java/plan.go index 397374b4..20d0ddf3 100644 --- a/internal/java/plan.go +++ b/internal/java/plan.go @@ -109,19 +109,15 @@ func DetermineJDKVersion(pj types.JavaProjectType, src afero.Fs) string { return defaultVersion } +// DetermineTargetExt determines the target extension of the Java project. func DetermineTargetExt(src afero.Fs) string { - if utils.HasFile(src, "pom.xml") { - pom, err := afero.ReadFile(src, "pom.xml") - if err != nil { - return "jar" - } - re := regexp.MustCompile(`(.*)`) - matches := re.FindStringSubmatch(string(pom)) - if len(matches) > 1 { - if matches[1] == "war" { - return "war" - } - } + pom, err := afero.ReadFile(src, "pom.xml") + if err != nil { + return "jar" + } + + if strings.Contains(string(pom), "war") { + return "war" } return "jar"