diff options
author | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-02-07 14:58:10 +0300 |
---|---|---|
committer | Evgeny Mandrikov <mandrikov@gmail.com> | 2011-02-07 15:34:28 +0300 |
commit | c1904d3f5fd44873a8ef2b6d097d4bcb731b92a7 (patch) | |
tree | 437ead6f8f9b0cfd42e83d5236f8ccb3b60c8f31 /sonar-batch | |
parent | bbfce797275cf13e8c7a0e43aa29406175c89bfc (diff) | |
download | sonarqube-c1904d3f5fd44873a8ef2b6d097d4bcb731b92a7.tar.gz sonarqube-c1904d3f5fd44873a8ef2b6d097d4bcb731b92a7.zip |
Add MavenInitializer
* Configures Java versions and encoding of sources based on Maven POM
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java b/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java index 208cf78cb3a..0086f1015c0 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java @@ -19,24 +19,21 @@ */ package org.sonar.batch; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + import org.apache.commons.configuration.*; -import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateUtils; import org.apache.maven.project.MavenProject; import org.sonar.api.CoreProperties; -import org.sonar.api.batch.maven.MavenUtils; import org.sonar.api.database.DatabaseSession; import org.sonar.api.database.model.ResourceModel; import org.sonar.api.database.model.Snapshot; import org.sonar.api.resources.Java; import org.sonar.api.resources.Project; import org.sonar.api.utils.SonarException; -import org.sonar.java.api.JavaUtils; - -import java.text.DateFormat; -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; public class MavenProjectBuilder { @@ -78,26 +75,6 @@ public class MavenProjectBuilder { void configure(Project project, Configuration projectConfiguration) { Date analysisDate = loadAnalysisDate(projectConfiguration); MavenProject pom = project.getPom(); - if (pom != null) { - /* - * TODO actually this is a dirty hack - * See http://jira.codehaus.org/browse/SONAR-2148 - * Get Java source and target versions from maven-compiler-plugin. - */ - if (StringUtils.isBlank(projectConfiguration.getString(JavaUtils.JAVA_SOURCE_PROPERTY))) { - projectConfiguration.setProperty(JavaUtils.JAVA_SOURCE_PROPERTY, MavenUtils.getJavaSourceVersion(pom)); - } - if (StringUtils.isBlank(projectConfiguration.getString(JavaUtils.JAVA_TARGET_PROPERTY))) { - projectConfiguration.setProperty(JavaUtils.JAVA_TARGET_PROPERTY, MavenUtils.getJavaVersion(pom)); - } - /* - * See http://jira.codehaus.org/browse/SONAR-2151 - * Get source encoding from POM - */ - if (StringUtils.isBlank(projectConfiguration.getString(CoreProperties.ENCODING_PROPERTY))) { - projectConfiguration.setProperty(CoreProperties.ENCODING_PROPERTY, MavenUtils.getSourceEncoding(pom)); - } - } project.setConfiguration(projectConfiguration) .setExclusionPatterns(loadExclusionPatterns(projectConfiguration)) .setAnalysisDate(analysisDate) |