List of usage examples for org.apache.maven.project MavenProject setReporting
@Deprecated public void setReporting(Reporting reporting)
From source file:org.sonar.batch.InMemoryPomCreator.java
License:Open Source License
public MavenProject create() { File workDir = project.getWorkDir(); String buildDirectory = workDir.getAbsolutePath() + "/target"; Properties properties = project.getProperties(); if (project.getBinaries().size() == 0) { project.addBinaryDir(buildDirectory + "/classes"); }// w w w . j a va 2 s . c o m final MavenProject pom = new MavenProject() { /** * This allows to specify base directory without specifying location of a pom.xml */ @Override public File getBasedir() { return project.getBaseDir(); }; /** * This allows to specify project classpath (binaries + libraries). */ @Override public List<String> getCompileClasspathElements() throws DependencyResolutionRequiredException { List<String> cp = new ArrayList<String>(); cp.addAll(project.getBinaries()); cp.addAll(project.getLibraries()); return cp; } }; String key = getPropertyOrDie(properties, CoreProperties.PROJECT_KEY_PROPERTY); String[] keys = key.split(":"); pom.setGroupId(keys[0]); pom.setArtifactId(keys[1]); pom.setVersion(getPropertyOrDie(properties, CoreProperties.PROJECT_VERSION_PROPERTY)); pom.setName(properties.getProperty(CoreProperties.PROJECT_NAME_PROPERTY, "Unnamed - " + key)); pom.setDescription(properties.getProperty(CoreProperties.PROJECT_DESCRIPTION_PROPERTY, "")); pom.getModel().setProperties(properties); pom.setArtifacts(Collections.EMPTY_SET); // Configure fake directories pom.getBuild().setDirectory(buildDirectory); pom.getBuild().setOutputDirectory(project.getBinaries().get(0)); Reporting reporting = new Reporting(); String reportingOutputDirectory = buildDirectory + "/site"; reporting.setOutputDirectory(reportingOutputDirectory); pom.setReporting(reporting); // Configure source directories for (String dir : project.getSourceDirs()) { pom.addCompileSourceRoot(dir); } // Configure test directories for (String dir : project.getTestDirs()) { pom.addTestCompileSourceRoot(dir); } return pom; }