From 79705bb2dbdf264e1ce1865e4557bda867408bf9 Mon Sep 17 00:00:00 2001 From: Michael Amann Date: Mon, 31 Oct 2022 19:48:20 +0100 Subject: [PATCH] moved optional arguments, to prevent failure when not providing them --- pkg/plugin/plugin.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/plugin/plugin.go b/pkg/plugin/plugin.go index 93b8203..59699a9 100644 --- a/pkg/plugin/plugin.go +++ b/pkg/plugin/plugin.go @@ -127,8 +127,6 @@ func (p *Plugin) generateScannerArgs() []string { if !p.Config.UsingProperties { argsParameter := []string{ "-Dsonar.projectKey=" + p.Config.Key, - "-Dsonar.projectName=" + p.Config.Name, - "-Dsonar.projectVersion=" + p.Config.Version, "-Dsonar.sources=" + p.Config.Sources, "-Dsonar.ws.timeout=" + strconv.Itoa(p.Config.HttpTimeout), "-Dsonar.log.level=" + p.Config.SonarLogLevel, @@ -137,10 +135,11 @@ func (p *Plugin) generateScannerArgs() []string { } args.append(argsParameter...) + args.appendIfNotEmpty("-Dsonar.projectName=", p.Config.Name) + args.appendIfNotEmpty("-Dsonar.projectVersion=", p.Config.Version) args.appendIfNotEmpty("-Dsonar.java.binaries=", p.Config.Binaries) args.appendIfNotEmpty("-Dsonar.exclusions=", p.Config.Exclusions) args.appendIfNotEmpty("-Dsonar.inclusions=", p.Config.Inclusions) - } p.Logger.Debugw("argsbuilder",