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>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-api</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
<artifactId>commons-cli</artifactId>
|
||||
|
@ -79,13 +84,14 @@
|
|||
</dependencies>
|
||||
<reports>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- plugin>
|
||||
<groupId>org.apache.maven.reports</groupId>
|
||||
<artifactId>mail-lists</artifactId>
|
||||
</plugin>
|
||||
</plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.reports</groupId>
|
||||
<artifactId>dependencies</artifactId>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reports>
|
||||
|
|
|
@ -27,6 +27,7 @@ import org.codehaus.plexus.component.repository.exception.ComponentLookupExcepti
|
|||
import org.codehaus.plexus.context.Context;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
|
@ -126,6 +127,18 @@ public class MavenSession
|
|||
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()
|
||||
{
|
||||
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;
|
||||
|
||||
if ( pluginConfig != null )
|
||||
|
@ -791,7 +806,7 @@ public class DefaultPluginManager
|
|||
artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
|
||||
"maven-settings", "maven-monitor", "maven-plugin-api",
|
||||
"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"} );
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,17 @@ package org.apache.maven.plugin;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
import org.apache.maven.execution.MavenSession;
|
||||
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.ExpressionEvaluator;
|
||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
||||
import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @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 );
|
||||
}
|
||||
}
|
||||
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" ) )
|
||||
{
|
||||
value = context.getLocalRepository();
|
||||
|
|
|
@ -15,6 +15,11 @@
|
|||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-api</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>doxia</groupId>
|
||||
<artifactId>doxia-core</artifactId>
|
||||
|
@ -30,10 +35,5 @@
|
|||
<artifactId>wagon-ssh</artifactId>
|
||||
<version>1.0-alpha-3-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-manager</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -4,17 +4,21 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.MavenReport;
|
||||
import org.apache.maven.reporting.MavenReportConfiguration;
|
||||
import org.apache.maven.reporting.manager.MavenReportManager;
|
||||
import org.codehaus.doxia.site.renderer.SiteRenderer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @goal site
|
||||
* @description Doxia plugin
|
||||
*
|
||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public class DoxiaMojo
|
||||
extends AbstractMojo
|
||||
|
@ -32,7 +36,7 @@ public class DoxiaMojo
|
|||
private String generatedSiteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expressoin="${project.build.directory}/site"
|
||||
* @parameter expression="${project.build.directory}/site"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
@ -57,11 +61,11 @@ public class DoxiaMojo
|
|||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.reporting.manager.MavenReportManager}"
|
||||
* @parameter expression="${reports}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenReportManager reportManager;
|
||||
private Map reports;
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
|
@ -87,16 +91,16 @@ public class DoxiaMojo
|
|||
config.setModel( project.getModel() );
|
||||
|
||||
config.setOutputDirectory( new File( generatedSiteDirectory ) );
|
||||
|
||||
if ( project.getReports() != null )
|
||||
if ( reports != null )
|
||||
{
|
||||
reportManager.addReports( project.getReports(), localRepository, remoteRepositories );
|
||||
|
||||
for ( Iterator i = reportManager.getReports().keySet().iterator(); i.hasNext(); )
|
||||
System.out.println(reports.size());
|
||||
for ( Iterator i = reports.values().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>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<!-- parent>
|
||||
<parent>
|
||||
<artifactId>mojo</artifactId>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent -->
|
||||
</parent>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
|
|
@ -12,4 +12,30 @@
|
|||
<instantiation-strategy>per-lookup</instantiation-strategy>
|
||||
</component>
|
||||
</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>
|
||||
|
|
Loading…
Reference in New Issue