mirror of https://github.com/apache/maven.git
Initial version of site generation with repots.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@168031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0b0b8f89f3
commit
e9a7f3ce85
|
@ -49,6 +49,11 @@
|
||||||
<artifactId>maven-plugin-descriptor</artifactId>
|
<artifactId>maven-plugin-descriptor</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.reporting</groupId>
|
||||||
|
<artifactId>maven-reporting-api</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-cli</groupId>
|
<groupId>commons-cli</groupId>
|
||||||
<artifactId>commons-cli</artifactId>
|
<artifactId>commons-cli</artifactId>
|
||||||
|
@ -79,13 +84,14 @@
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<reports>
|
<reports>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<!-- plugin>
|
||||||
<groupId>org.apache.maven.reports</groupId>
|
<groupId>org.apache.maven.reports</groupId>
|
||||||
<artifactId>mail-lists</artifactId>
|
<artifactId>mail-lists</artifactId>
|
||||||
</plugin>
|
</plugin -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.reports</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>dependencies</artifactId>
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</reports>
|
</reports>
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
||||||
import org.codehaus.plexus.context.Context;
|
import org.codehaus.plexus.context.Context;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||||
|
@ -126,6 +127,18 @@ public class MavenSession
|
||||||
return container.lookup( role, roleHint );
|
return container.lookup( role, roleHint );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List lookupList( String role )
|
||||||
|
throws ComponentLookupException
|
||||||
|
{
|
||||||
|
return container.lookupList( role );
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map lookupMap( String role )
|
||||||
|
throws ComponentLookupException
|
||||||
|
{
|
||||||
|
return container.lookupMap( role );
|
||||||
|
}
|
||||||
|
|
||||||
public EventDispatcher getEventDispatcher()
|
public EventDispatcher getEventDispatcher()
|
||||||
{
|
{
|
||||||
return eventDispatcher;
|
return eventDispatcher;
|
||||||
|
|
|
@ -216,6 +216,21 @@ public class DefaultPluginManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( project.getReports() != null )
|
||||||
|
{
|
||||||
|
for ( Iterator it = project.getReports().getPlugins().iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
|
||||||
|
|
||||||
|
if ( groupId.equals( plugin.getGroupId() ) && artifactId.equals( plugin.getArtifactId() ) )
|
||||||
|
{
|
||||||
|
pluginConfig = plugin;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String version = null;
|
String version = null;
|
||||||
|
|
||||||
if ( pluginConfig != null )
|
if ( pluginConfig != null )
|
||||||
|
@ -791,7 +806,7 @@ public class DefaultPluginManager
|
||||||
artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
|
artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
|
||||||
"maven-settings", "maven-monitor", "maven-plugin-api",
|
"maven-settings", "maven-monitor", "maven-plugin-api",
|
||||||
"maven-plugin-descriptor", "plexus-container-default",
|
"maven-plugin-descriptor", "plexus-container-default",
|
||||||
"maven-project", "plexus-container-artifact",
|
"maven-project", "plexus-container-artifact", "maven-reporting-api", "doxia-core",
|
||||||
"wagon-provider-api", "classworlds", "maven-plugin"} );
|
"wagon-provider-api", "classworlds", "maven-plugin"} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,17 @@ package org.apache.maven.plugin;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.project.path.PathTranslator;
|
import org.apache.maven.project.path.PathTranslator;
|
||||||
|
import org.apache.maven.reporting.MavenReport;
|
||||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
|
||||||
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||||
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
|
@ -90,6 +93,41 @@ public class PluginParameterExpressionEvaluator
|
||||||
throw new ExpressionEvaluationException( "Cannot lookup component: " + role + ".", e );
|
throw new ExpressionEvaluationException( "Cannot lookup component: " + role + ".", e );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (expression.equals( "reports" ) )
|
||||||
|
{
|
||||||
|
String role = PluginManager.ROLE;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
PluginManager pluginManager = (PluginManager) context.lookup( role );
|
||||||
|
for ( Iterator it = context.getProject().getReports().getPlugins().iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
org.apache.maven.model.Plugin plugin = (org.apache.maven.model.Plugin) it.next();
|
||||||
|
pluginManager.verifyPlugin( plugin.getGroupId(), plugin.getArtifactId(), context );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch ( ComponentLookupException cle )
|
||||||
|
{
|
||||||
|
throw new ExpressionEvaluationException( "Cannot lookup component: " + role + ".", cle );
|
||||||
|
}
|
||||||
|
catch ( ArtifactResolutionException are )
|
||||||
|
{
|
||||||
|
throw new ExpressionEvaluationException( "Cannot resolve component: " + role + ".", are );
|
||||||
|
}
|
||||||
|
catch ( PluginManagerException pme )
|
||||||
|
{
|
||||||
|
throw new ExpressionEvaluationException( "Cannot verify component: " + role + ".", pme );
|
||||||
|
}
|
||||||
|
|
||||||
|
role = MavenReport.ROLE;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
value = context.lookupMap( role );
|
||||||
|
}
|
||||||
|
catch ( ComponentLookupException cle )
|
||||||
|
{
|
||||||
|
throw new ExpressionEvaluationException( "Cannot lookup component: " + role + ".", cle );
|
||||||
|
}
|
||||||
|
}
|
||||||
else if ( expression.equals( "localRepository" ) )
|
else if ( expression.equals( "localRepository" ) )
|
||||||
{
|
{
|
||||||
value = context.getLocalRepository();
|
value = context.getLocalRepository();
|
||||||
|
|
|
@ -15,6 +15,11 @@
|
||||||
<artifactId>maven-project</artifactId>
|
<artifactId>maven-project</artifactId>
|
||||||
<version>2.0-SNAPSHOT</version>
|
<version>2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.reporting</groupId>
|
||||||
|
<artifactId>maven-reporting-api</artifactId>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>doxia</groupId>
|
<groupId>doxia</groupId>
|
||||||
<artifactId>doxia-core</artifactId>
|
<artifactId>doxia-core</artifactId>
|
||||||
|
@ -30,10 +35,5 @@
|
||||||
<artifactId>wagon-ssh</artifactId>
|
<artifactId>wagon-ssh</artifactId>
|
||||||
<version>1.0-alpha-3-SNAPSHOT</version>
|
<version>1.0-alpha-3-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven.reporting</groupId>
|
|
||||||
<artifactId>maven-reporting-manager</artifactId>
|
|
||||||
<version>2.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -4,17 +4,21 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.plugin.AbstractMojo;
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
import org.apache.maven.plugin.MojoExecutionException;
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
import org.apache.maven.reporting.MavenReport;
|
||||||
import org.apache.maven.reporting.MavenReportConfiguration;
|
import org.apache.maven.reporting.MavenReportConfiguration;
|
||||||
import org.apache.maven.reporting.manager.MavenReportManager;
|
|
||||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @goal site
|
* @goal site
|
||||||
* @description Doxia plugin
|
* @description Doxia plugin
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||||
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
public class DoxiaMojo
|
public class DoxiaMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
|
@ -32,7 +36,7 @@ public class DoxiaMojo
|
||||||
private String generatedSiteDirectory;
|
private String generatedSiteDirectory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter expressoin="${project.build.directory}/site"
|
* @parameter expression="${project.build.directory}/site"
|
||||||
* @required
|
* @required
|
||||||
*/
|
*/
|
||||||
private String outputDirectory;
|
private String outputDirectory;
|
||||||
|
@ -57,11 +61,11 @@ public class DoxiaMojo
|
||||||
private MavenProject project;
|
private MavenProject project;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter expression="${component.org.apache.maven.reporting.manager.MavenReportManager}"
|
* @parameter expression="${reports}"
|
||||||
* @required
|
* @required
|
||||||
* @readonly
|
* @readonly
|
||||||
*/
|
*/
|
||||||
private MavenReportManager reportManager;
|
private Map reports;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @parameter expression="${localRepository}"
|
* @parameter expression="${localRepository}"
|
||||||
|
@ -87,16 +91,16 @@ public class DoxiaMojo
|
||||||
config.setModel( project.getModel() );
|
config.setModel( project.getModel() );
|
||||||
|
|
||||||
config.setOutputDirectory( new File( generatedSiteDirectory ) );
|
config.setOutputDirectory( new File( generatedSiteDirectory ) );
|
||||||
|
if ( reports != null )
|
||||||
if ( project.getReports() != null )
|
|
||||||
{
|
{
|
||||||
reportManager.addReports( project.getReports(), localRepository, remoteRepositories );
|
System.out.println(reports.size());
|
||||||
|
for ( Iterator i = reports.values().iterator(); i.hasNext(); )
|
||||||
for ( Iterator i = reportManager.getReports().keySet().iterator(); i.hasNext(); )
|
|
||||||
{
|
{
|
||||||
String reportName = (String) i.next();
|
MavenReport report = (MavenReport) i.next();
|
||||||
|
|
||||||
reportManager.executeReport( reportName, config );
|
report.setConfiguration( config );
|
||||||
|
|
||||||
|
report.generate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<project>
|
<project>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<!-- parent>
|
<parent>
|
||||||
<artifactId>mojo</artifactId>
|
<artifactId>mojo</artifactId>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent -->
|
</parent>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
|
@ -12,4 +12,30 @@
|
||||||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||||
</component>
|
</component>
|
||||||
</components>
|
</components>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>doxia</groupId>
|
||||||
|
<artifactId>doxia-core</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>1.0-alpha-2-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.reporting</groupId>
|
||||||
|
<artifactId>maven-reporting-api</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-model</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
<version>2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
</component-set>
|
</component-set>
|
||||||
|
|
Loading…
Reference in New Issue