From c65905d4c3bc59739032032db56e4e993fe57b37 Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Sun, 23 Jan 2011 20:58:49 +0300 Subject: [PATCH] SONAR-2126: Change api to work with project file system --- .../src/main/java/org/sonar/batch/MavenProjectBuilder.java | 4 +++- .../src/test/java/org/sonar/api/test/MavenTestUtils.java | 4 +++- 2 files changed, 6 insertions(+), 2 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 0145b07d7a9..2bd3866cd16 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java +++ b/sonar-batch/src/main/java/org/sonar/batch/MavenProjectBuilder.java @@ -89,7 +89,9 @@ public class MavenProjectBuilder { fs.setBaseDir(pom.getBasedir()); fs.setBuildDir(pom.getBuild().getDirectory()); projectConfiguration.setProperty("project.build.outputDirectory", pom.getBuild().getOutputDirectory()); - projectConfiguration.setProperty("project.reporting.outputDirectory", pom.getReporting().getOutputDirectory()); + if (pom.getReporting() != null) { + projectConfiguration.setProperty("project.reporting.outputDirectory", pom.getReporting().getOutputDirectory()); + } projectConfiguration.setProperty("sonar.java.sourceVersion", MavenUtils.getJavaSourceVersion(pom)); projectConfiguration.setProperty("sonar.java.targetVersion", MavenUtils.getJavaVersion(pom)); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java b/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java index a681327409e..3afd4569eb8 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/test/MavenTestUtils.java @@ -76,7 +76,9 @@ public final class MavenTestUtils { fs.addTestDir(dir); } project.getConfiguration().setProperty("project.build.outputDirectory", pom.getBuild().getOutputDirectory()); - project.getConfiguration().setProperty("project.reporting.outputDirectory", pom.getReporting().getOutputDirectory()); + if (pom.getReporting() != null) { + project.getConfiguration().setProperty("project.reporting.outputDirectory", pom.getReporting().getOutputDirectory()); + } fs.setBaseDir(project.getPom().getBasedir()); fs.setBuildDir(project.getPom().getBuild().getDirectory()); return project; -- 2.39.5