diff --git a/pkg/util/maven/maven_command.go b/pkg/util/maven/maven_command.go index df7e0856b0..acaeb6c1fd 100644 --- a/pkg/util/maven/maven_command.go +++ b/pkg/util/maven/maven_command.go @@ -44,19 +44,23 @@ func (c *Command) Do(ctx context.Context) error { return err } - if e, ok := os.LookupEnv("MAVEN_WRAPPER"); (ok && e == "true") || !ok { - // Prepare maven wrapper helps when running the builder as Pod as it makes - // the builder container, Maven agnostic - if err := c.prepareMavenWrapper(ctx); err != nil { - return err - } - } - - mvnCmd := "./mvnw" + mvnCmd := "" if c, ok := os.LookupEnv("MAVEN_CMD"); ok { mvnCmd = c } + if mvnCmd == "" { + if e, ok := os.LookupEnv("MAVEN_WRAPPER"); (ok && e == "true") || !ok { + // Prepare maven wrapper helps when running the builder as Pod as it makes + // the builder container, Maven agnostic + if err := c.prepareMavenWrapper(ctx); err != nil { + return err + } + } + + mvnCmd = "./mvnw" + } + args := make([]string, 0) args = append(args, c.context.AdditionalArguments...)