aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-maven-plugin
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2013-06-20 17:21:30 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2013-06-20 17:23:56 +0200
commitf699d4683bfb31f0cd95d277cde92b4edaa3995f (patch)
tree187b183f56b87fcba4e6444380896f1fa0f6847e /sonar-maven-plugin
parent9035a835c690eb50abc5891ee0659212117d0391 (diff)
downloadsonarqube-f699d4683bfb31f0cd95d277cde92b4edaa3995f.tar.gz
sonarqube-f699d4683bfb31f0cd95d277cde92b4edaa3995f.zip
SONAR-4047 Maven command line properties were not passed to Sonar Runner
Diffstat (limited to 'sonar-maven-plugin')
-rw-r--r--sonar-maven-plugin/src/main/java/org/sonar/maven/SonarMojo.java12
1 files 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<Entry<Object, Object>> properties = project.getModel().getProperties().entrySet();
- for (Entry<Object, Object> 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);