From f699d4683bfb31f0cd95d277cde92b4edaa3995f Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 20 Jun 2013 17:21:30 +0200 Subject: [PATCH] SONAR-4047 Maven command line properties were not passed to Sonar Runner --- .../src/main/java/org/sonar/maven/SonarMojo.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java index 0a184927385..f5b18848593 100644 --- a/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java +++ b/sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java @@ -38,8 +38,6 @@ import org.sonar.runner.api.ScanProperties; import java.io.File; import java.io.IOException; -import java.util.Map.Entry; -import java.util.Set; /** * @goal sonar @@ -130,11 +128,11 @@ public final class SonarMojo extends AbstractMojo { public void execute() throws MojoExecutionException, MojoFailureException { EmbeddedRunner runner = EmbeddedRunner.create() - .setApp("Maven", getMavenVersion()); - Set> properties = project.getModel().getProperties().entrySet(); - for (Entry entry : properties) { - runner.setProperty(toString(entry.getKey()), toString(entry.getValue())); - } + .setApp("Maven", getMavenVersion()) + .addProperties(session.getExecutionProperties()) + .addProperties(project.getModel().getProperties()) + // Add user properties (ie command line arguments -Dsonar.xxx=yyyy) in last position to override all other + .addProperties(session.getUserProperties()); String encoding = getSourceEncoding(project); if (encoding != null) { runner.setProperty(ScanProperties.PROJECT_SOURCE_ENCODING, encoding); -- 2.39.5