From 0cae92051b50e9c2cc10440ec222497e67972dd4 Mon Sep 17 00:00:00 2001 From: Emmanuel Venisse Date: Thu, 28 Apr 2005 23:44:59 +0000 Subject: [PATCH] Add Dependencies Report git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@165233 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven-project-info-reports-plugin/pom.xml | 31 ++++++ .../projectinfo/DependenciesReport.java | 98 +++++++++++++++++++ .../resources/META-INF/plexus/components.xml | 15 +++ 3 files changed, 144 insertions(+) create mode 100644 sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml create mode 100644 sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java create mode 100644 sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml diff --git a/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml b/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml new file mode 100644 index 0000000000..950a52d1fa --- /dev/null +++ b/sandbox/maven-reports/maven-project-info-reports-plugin/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + org.apache.maven.plugins + maven-project-info-reports-plugin + 1.0-SNAPSHOT + maven-plugin + Maven Project Info Reports Plugin + 2005 + + + doxia + doxia-core + 1.0-alpha-2-SNAPSHOT + + + org.apache.maven.reporting + maven-reporting-api + 2.0-SNAPSHOT + + + org.apache.maven + maven-model + 2.0-SNAPSHOT + + + diff --git a/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java b/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java new file mode 100644 index 0000000000..bcf62d02d2 --- /dev/null +++ b/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/DependenciesReport.java @@ -0,0 +1,98 @@ +package org.apache.maven.reports.projectinfo; + +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.model.Dependency; +import org.apache.maven.model.Model; +import org.apache.maven.reporting.AbstractMavenReportRenderer; +import org.apache.maven.reporting.AbstractMavenReport; +import org.apache.maven.reporting.MavenReportException; +import org.codehaus.doxia.sink.Sink; + +import java.io.IOException; +import java.util.Iterator; + +/** + * @author Jason van Zyl + * @version $Id: DependenciesReport.java,v 1.2 2005/02/23 00:08:02 brett Exp $ + * @plexus.component + */ +public class DependenciesReport + extends AbstractMavenReport +{ + public void execute() + throws MavenReportException + { + try + { + DependenciesRenderer r = new DependenciesRenderer( getSink(), getConfiguration().getModel() ); + + r.render(); + } + catch( IOException e ) + { + throw new MavenReportException( "Can't write the report " + getOutputName(), e ); + } + } + + public String getOutputName() + { + return "dependencies"; + } + + static class DependenciesRenderer + extends AbstractMavenReportRenderer + { + private Model model; + + public DependenciesRenderer( Sink sink, Model model ) + { + super( sink ); + + this.model = model; + } + + // How to i18n these ... + public String getTitle() + { + return "Project Dependencies"; + } + + public void renderBody() + { + startSection( getTitle() ); + + startTable(); + + tableCaption( "Declared Dependencies" ); + + tableHeader( new String[]{"GroupId", "ArtifactId", "Version"} ); + + for ( Iterator i = model.getDependencies().iterator(); i.hasNext(); ) + { + Dependency d = (Dependency) i.next(); + + tableRow( new String[]{d.getGroupId(), d.getArtifactId(), d.getVersion()} ); + } + + endTable(); + + endSection(); + } + + } +} diff --git a/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml b/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000000..3a7c2c4a56 --- /dev/null +++ b/sandbox/maven-reports/maven-project-info-reports-plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,15 @@ + + + + + org.apache.maven.reporting.MavenReport + dependencies + org.apache.maven.reports.projectinfo.DependenciesReport + per-lookup + + +