You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2010/03/25 22:59:21 UTC
svn commit: r927606 - in /maven/plugins/branches/maven-site-plugin-3.x: ./
src/it/it-plugin-test/ src/main/java/org/apache/maven/plugins/site/
Author: bentmann
Date: Thu Mar 25 21:59:21 2010
New Revision: 927606
URL: http://svn.apache.org/viewvc?rev=927606&view=rev
Log:
o Decoupled plugin from reporting section and used ordinary plugin parameters
Added:
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java (with props)
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java (with props)
Modified:
maven/plugins/branches/maven-site-plugin-3.x/pom.xml
maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java
maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/MavenReportExecutorRequest.java
Modified: maven/plugins/branches/maven-site-plugin-3.x/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/pom.xml?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/pom.xml Thu Mar 25 21:59:21 2010
@@ -542,7 +542,7 @@ under the License.
<plugin>
<groupId>org.maven.ide.eclipse</groupId>
<artifactId>lifecycle-mapping</artifactId>
- <version>0.9.9-SNAPSHOT</version>
+ <version>0.10.0</version>
<configuration>
<mappingId>customizable</mappingId>
<configurators>
@@ -560,7 +560,7 @@ under the License.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
- <version>2.4.1</version>
+ <version>2.4.2</version>
</plugin>
</plugins>
</pluginManagement>
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/it/it-plugin-test/pom.xml Thu Mar 25 21:59:21 2010
@@ -1,32 +1,33 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.maven.plugins.it</groupId>
- <artifactId>it-plugin-test</artifactId>
- <packaging>maven-plugin</packaging>
- <version>1.0-SNAPSHOT</version>
- <name>it-plugin-test Maven Mojo</name>
- <url>http://maven.apache.org</url>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>2.2.1</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>3.8.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-plugin-plugin</artifactId>
- <version>2.5.1</version>
- </plugin>
- </plugins>
- </reporting>
-</project>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.maven.plugins.it</groupId>
+ <artifactId>it-plugin-test</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>it-plugin-test Maven Mojo</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.2</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <reporting>
+ <excludeDefaults>true</excludeDefaults>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.5.1</version>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java Thu Mar 25 21:59:21 2010
@@ -44,6 +44,12 @@ import org.codehaus.plexus.util.ReaderFa
public abstract class AbstractSiteMojo
extends AbstractMojo
{
+
+ /**
+ * @parameter
+ */
+ protected ReportPlugin[] reportPlugins;
+
/**
* A comma separated list of locales supported by Maven. The first valid token will be the default Locale
* for this instance of the Java Virtual Machine.
@@ -69,15 +75,14 @@ public abstract class AbstractSiteMojo
/**
* Directory containing the site.xml file and the source for apt, fml and xdoc docs.
*
- * @parameter expression="${basedir}/src/site"
- * @required
+ * @parameter default-value="${basedir}/src/site"
*/
protected File siteDirectory;
/**
* The maven project.
*
- * @parameter expression="${project}"
+ * @parameter default-value="${project}"
* @required
* @readonly
*/
@@ -86,18 +91,18 @@ public abstract class AbstractSiteMojo
/**
* The local repository.
*
- * @parameter expression="${localRepository}"
+ * @parameter default-value="${localRepository}"
*/
protected ArtifactRepository localRepository;
/**
* The reactor projects.
*
- * @parameter expression="${reactorProjects}"
+ * @parameter default-value="${reactorProjects}"
* @required
* @readonly
*/
- protected List reactorProjects;
+ protected List<MavenProject> reactorProjects;
/**
* Specifies the input encoding.
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java Thu Mar 25 21:59:21 2010
@@ -196,7 +196,7 @@ public abstract class AbstractSiteRender
protected List<MavenReportExecution> getReports()
throws MojoExecutionException
{
- if ( this.project.getReporting() == null || this.project.getReporting().getPlugins().isEmpty() )
+ if ( reportPlugins == null || reportPlugins.length <= 0 )
{
return Collections.emptyList();
}
@@ -204,6 +204,7 @@ public abstract class AbstractSiteRender
mavenReportExecutorRequest.setLocalRepository( localRepository );
mavenReportExecutorRequest.setMavenSession( mavenSession );
mavenReportExecutorRequest.setProject( project );
+ mavenReportExecutorRequest.setReportPlugins( reportPlugins );
return mavenReportExecutor.buildMavenReports( mavenReportExecutorRequest );
}
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/DefaultMavenReportExecutor.java Thu Mar 25 21:59:21 2010
@@ -29,8 +29,6 @@ import org.apache.maven.artifact.reposit
import org.apache.maven.artifact.resolver.filter.ExclusionSetFilter;
import org.apache.maven.lifecycle.LifecycleExecutor;
import org.apache.maven.model.Plugin;
-import org.apache.maven.model.ReportPlugin;
-import org.apache.maven.model.ReportSet;
import org.apache.maven.plugin.MavenPluginManager;
import org.apache.maven.plugin.Mojo;
import org.apache.maven.plugin.MojoExecution;
@@ -112,9 +110,8 @@ public class DefaultMavenReportExecutor
List<MavenReportExecution> reports = new ArrayList<MavenReportExecution>();
- for ( ReportPlugin reportPlugin : mavenReportExecutorRequest.getProject().getReporting().getPlugins() )
+ for ( ReportPlugin reportPlugin : mavenReportExecutorRequest.getReportPlugins() )
{
-
Plugin plugin = new Plugin();
plugin.setGroupId( reportPlugin.getGroupId() );
plugin.setArtifactId( reportPlugin.getArtifactId() );
@@ -175,10 +172,10 @@ public class DefaultMavenReportExecutor
if ( reportPlugin.getConfiguration() != null )
{
+ Xpp3Dom reportConfiguration = convert( reportPlugin.getConfiguration() );
Xpp3Dom mergedConfiguration =
- Xpp3DomUtils.mergeXpp3Dom( (Xpp3Dom) reportPlugin.getConfiguration(),
- convert( mojoDescriptor ) );
+ Xpp3DomUtils.mergeXpp3Dom( reportConfiguration, convert( mojoDescriptor ) );
Xpp3Dom cleanedConfiguration = new Xpp3Dom( "configuration" );
if ( mergedConfiguration.getChildren() != null )
@@ -338,29 +335,28 @@ public class DefaultMavenReportExecutor
private Xpp3Dom convert( MojoDescriptor mojoDescriptor )
{
- Xpp3Dom dom = new Xpp3Dom( "configuration" );
+ PlexusConfiguration config = mojoDescriptor.getMojoConfiguration();
+ return ( config != null ) ? convert( config ) : new Xpp3Dom( "configuration" );
+ }
- PlexusConfiguration c = mojoDescriptor.getMojoConfiguration();
+ private Xpp3Dom convert( PlexusConfiguration config )
+ {
+ if ( config == null )
+ {
+ return null;
+ }
- PlexusConfiguration[] ces = c.getChildren();
+ Xpp3Dom dom = new Xpp3Dom( config.getName() );
+ dom.setValue( config.getValue( null ) );
- if ( ces != null )
+ for ( String attrib : config.getAttributeNames() )
{
- for ( PlexusConfiguration ce : ces )
- {
- String value = ce.getValue( null );
- String defaultValue = ce.getAttribute( "default-value", null );
- if ( value != null || defaultValue != null )
- {
- Xpp3Dom e = new Xpp3Dom( ce.getName() );
- e.setValue( value );
- if ( defaultValue != null )
- {
- e.setAttribute( "default-value", defaultValue );
- }
- dom.addChild( e );
- }
- }
+ dom.setAttribute( attrib, config.getAttribute( attrib, null ) );
+ }
+
+ for ( int n = config.getChildCount(), i = 0; i < n; i++ )
+ {
+ dom.addChild( convert( config.getChild( i ) ) );
}
return dom;
Modified: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/MavenReportExecutorRequest.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/MavenReportExecutorRequest.java?rev=927606&r1=927605&r2=927606&view=diff
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/MavenReportExecutorRequest.java (original)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/MavenReportExecutorRequest.java Thu Mar 25 21:59:21 2010
@@ -31,6 +31,8 @@ public class MavenReportExecutorRequest
private MavenProject project;
+ private ReportPlugin[] reportPlugins;
+
public ArtifactRepository getLocalRepository()
{
return localRepository;
@@ -61,4 +63,14 @@ public class MavenReportExecutorRequest
this.project = project;
}
+ public ReportPlugin[] getReportPlugins()
+ {
+ return reportPlugins;
+ }
+
+ public void setReportPlugins( ReportPlugin[] reportPlugins )
+ {
+ this.reportPlugins = reportPlugins;
+ }
+
}
Added: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java?rev=927606&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java Thu Mar 25 21:59:21 2010
@@ -0,0 +1,98 @@
+package org.apache.maven.plugins.site;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+
+/**
+ * Represents a reporting plugin and its executions.
+ */
+public class ReportPlugin
+{
+
+ private String groupId = "org.apache.maven.plugins";
+
+ private String artifactId;
+
+ private String version;
+
+ private PlexusConfiguration configuration;
+
+ private List<ReportSet> reportSets;
+
+ public String getGroupId()
+ {
+ return this.groupId;
+ }
+
+ public void setGroupId( String groupId )
+ {
+ this.groupId = groupId;
+ }
+
+ public String getArtifactId()
+ {
+ return this.artifactId;
+ }
+
+ public void setArtifactId( String artifactId )
+ {
+ this.artifactId = artifactId;
+ }
+
+ public String getVersion()
+ {
+ return this.version;
+ }
+
+ public void setVersion( String version )
+ {
+ this.version = version;
+ }
+
+ public PlexusConfiguration getConfiguration()
+ {
+ return this.configuration;
+ }
+
+ public void setConfiguration( PlexusConfiguration configuration )
+ {
+ this.configuration = configuration;
+ }
+
+ public List<ReportSet> getReportSets()
+ {
+ if ( this.reportSets == null )
+ {
+ this.reportSets = new ArrayList<ReportSet>();
+ }
+
+ return this.reportSets;
+ }
+
+ public void setReportSets( List<ReportSet> reportSets )
+ {
+ this.reportSets = reportSets;
+ }
+
+}
Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportPlugin.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java
URL: http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java?rev=927606&view=auto
==============================================================================
--- maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java (added)
+++ maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java Thu Mar 25 21:59:21 2010
@@ -0,0 +1,80 @@
+package org.apache.maven.plugins.site;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 java.util.ArrayList;
+import java.util.List;
+
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+
+/**
+ * Represents a set of reports and configuration to be used to generate them.
+ */
+public class ReportSet
+{
+
+ private String id = "default";
+
+ private PlexusConfiguration configuration;
+
+ private List<String> reports;
+
+ public String getId()
+ {
+ return this.id;
+ }
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ public PlexusConfiguration getConfiguration()
+ {
+ return this.configuration;
+ }
+
+ public void setConfiguration( PlexusConfiguration configuration )
+ {
+ this.configuration = configuration;
+ }
+
+ public List<String> getReports()
+ {
+ if ( this.reports == null )
+ {
+ this.reports = new ArrayList<String>();
+ }
+
+ return this.reports;
+ }
+
+ public void setReports( List<String> reports )
+ {
+ this.reports = reports;
+ }
+
+ @Override
+ public String toString()
+ {
+ return getId();
+ }
+
+}
Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportSet.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision