From b005ece7c498bdafd73efb360cb230c466c09510 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Wed, 23 Feb 2005 00:06:06 +0000 Subject: [PATCH] get project reports working git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163376 13f79535-47bb-0310-9956-ffa450edef68 --- maven-core/.cvsignore | 1 + maven-core/pom.xml | 4 ++++ maven-reporting-api/pom.xml | 13 +++++++++++ .../reporting/DefaultMavenReportManager.java | 22 ++++++++++++++++--- .../apache/maven/reporting/MavenReport.java | 6 ++++- .../maven/reporting/MavenReportManager.java | 5 ++++- 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/maven-core/.cvsignore b/maven-core/.cvsignore index d9cded9200..cafe4f48c2 100644 --- a/maven-core/.cvsignore +++ b/maven-core/.cvsignore @@ -9,3 +9,4 @@ dist target .classpath .project +build.xml diff --git a/maven-core/pom.xml b/maven-core/pom.xml index 2c1f586db2..854b59801c 100644 --- a/maven-core/pom.xml +++ b/maven-core/pom.xml @@ -64,4 +64,8 @@ scp://www.apache.org//www/maven.apache.org/m2 + + mail-lists + dependencies + diff --git a/maven-reporting-api/pom.xml b/maven-reporting-api/pom.xml index 57f3371b39..44e7fa4a43 100755 --- a/maven-reporting-api/pom.xml +++ b/maven-reporting-api/pom.xml @@ -12,6 +12,13 @@ org.apache.maven.reporting + + + maven + maven-project-reports-plugin + 1.0-SNAPSHOT + plugin + doxia doxia-core @@ -23,4 +30,10 @@ 3.8.1 + + + compiler:compile + plexus:descriptor + + diff --git a/maven-reporting-api/src/main/java/org/apache/maven/reporting/DefaultMavenReportManager.java b/maven-reporting-api/src/main/java/org/apache/maven/reporting/DefaultMavenReportManager.java index bcbd9e3950..a311be6141 100755 --- a/maven-reporting-api/src/main/java/org/apache/maven/reporting/DefaultMavenReportManager.java +++ b/maven-reporting-api/src/main/java/org/apache/maven/reporting/DefaultMavenReportManager.java @@ -1,5 +1,11 @@ package org.apache.maven.reporting; +import org.apache.maven.model.Model; +import org.codehaus.doxia.sink.Sink; +import org.codehaus.doxia.site.renderer.SiteRenderer; + +import java.util.Map; + /* * Copyright 2005 The Apache Software Foundation. * @@ -21,13 +27,23 @@ package org.apache.maven.reporting; * * @author Brett Porter * @version $Id$ + * @plexus.component */ public class DefaultMavenReportManager implements MavenReportManager { - public MavenReport getReport( String name ) + private Map mavenReports; + + /** + * @todo we need some type of response + * @todo don't want to be passing in model - use report configuration + */ + public void executeReport( String name, Model model, SiteRenderer siteRenderer, String outputDirectory ) + throws Exception { - // TODO: return the report - return null; + MavenReport report = (MavenReport) mavenReports.get( name ); + + Sink sink = siteRenderer.createSink( outputDirectory, report.getOutputName() ); + report.execute( model, sink ); } } diff --git a/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReport.java b/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReport.java index 8501e00d30..7f86d34943 100755 --- a/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReport.java +++ b/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReport.java @@ -16,6 +16,7 @@ package org.apache.maven.reporting; * limitations under the License. */ +import org.apache.maven.model.Model; import org.codehaus.doxia.sink.Sink; /** @@ -28,6 +29,9 @@ public interface MavenReport { String ROLE = MavenReport.class.getName(); - void execute( Sink sink ) + /** @todo don't want the model here long term. */ + void execute( Model model, Sink sink ) throws MavenReportException; + + String getOutputName(); } diff --git a/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReportManager.java b/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReportManager.java index d992a9e9d4..8345ae4e34 100755 --- a/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReportManager.java +++ b/maven-reporting-api/src/main/java/org/apache/maven/reporting/MavenReportManager.java @@ -16,6 +16,9 @@ package org.apache.maven.reporting; * limitations under the License. */ +import org.apache.maven.model.Model; +import org.codehaus.doxia.site.renderer.SiteRenderer; + /** * Manage the set of available reports. * @@ -26,5 +29,5 @@ public interface MavenReportManager { String ROLE = MavenReportManager.class.getName(); - MavenReport getReport( String name ); + void executeReport( String name, Model model, SiteRenderer siteRenderer, String outputDirectory ) throws Exception; }