move the plugin-plugin to the plugin-tools module
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@589471 13f79535-47bb-0310-9956-ffa450edef68master
parent
ae1527eb0b
commit
d041ecb851
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
~ 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.
|
||||
|
||||
-->
|
||||
<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">
|
||||
<parent>
|
||||
<groupId>org.apache.maven.plugintools</groupId>
|
||||
<artifactId>maven-plugin-tools</artifactId>
|
||||
<version>2.4-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>Maven PLUGIN Plugin</name>
|
||||
<description>
|
||||
The Plugin Plugin is used to create a Maven plugin descriptor for any Mojo's found in the source tree,
|
||||
to include in the JAR. It is also used to generate Xdoc files for the Mojos as well as for updating the
|
||||
plugin registry and the artifact metadata.
|
||||
</description>
|
||||
<inceptionYear>2001</inceptionYear>
|
||||
<prerequisites>
|
||||
<maven>2.0.6</maven>
|
||||
</prerequisites>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-api</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-repository-metadata</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-project</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-descriptor</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-registry</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-api</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-java</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact-manager</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-artifact</artifactId>
|
||||
<version>2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven</groupId>
|
||||
<artifactId>maven-plugin-tools-beanshell</artifactId>
|
||||
<version>2.1</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-impl</artifactId>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.reporting</groupId>
|
||||
<artifactId>maven-reporting-api</artifactId>
|
||||
<version>2.0.4</version>
|
||||
</dependency>
|
||||
|
||||
<!-- doxia -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.doxia</groupId>
|
||||
<artifactId>doxia-sink-api</artifactId>
|
||||
<version>${doxia.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.doxia</groupId>
|
||||
<artifactId>doxia-core</artifactId>
|
||||
<version>${doxia.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.doxia</groupId>
|
||||
<artifactId>doxia-site-renderer</artifactId>
|
||||
<version>${doxia-sitetools.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-component-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- plexus -->
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-utils</artifactId>
|
||||
<version>1.4.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.codehaus.plexus</groupId>
|
||||
<artifactId>plexus-container-default</artifactId>
|
||||
<version>1.0-alpha-9</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- pin to a previous version so it doesn't get reloaded during build -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
</build>
|
||||
<properties>
|
||||
<doxia.version>1.0-alpha-10-SNAPSHOT</doxia.version>
|
||||
<doxia-sitetools.version>1.0-alpha-10-SNAPSHOT</doxia-sitetools.version>
|
||||
</properties>
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>apache.website</id>
|
||||
<url>scp://people.apache.org/www/maven.apache.org/plugins/maven-plugin-plugin</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
package org.apache.maven.plugin.plugin;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.tools.plugin.extractor.ExtractionException;
|
||||
import org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.scanner.MojoScanner;
|
||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id$
|
||||
*/
|
||||
public abstract class AbstractGeneratorMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* The project currently being built.
|
||||
*
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
*/
|
||||
protected MavenProject project;
|
||||
|
||||
/**
|
||||
* The component used for scanning the source tree for mojos.
|
||||
*
|
||||
* @parameter expression="${component.org.apache.maven.tools.plugin.scanner.MojoScanner}"
|
||||
* @required
|
||||
*/
|
||||
protected MojoScanner mojoScanner;
|
||||
|
||||
/**
|
||||
* The goal prefix that will appear before the ":".
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
protected String goalPrefix;
|
||||
|
||||
/**
|
||||
* The names of extractors to use.
|
||||
* <p/>
|
||||
* If not set, all extractors will be used. If set to an empty extractor name, no extractors
|
||||
* will be used.
|
||||
* <p/>
|
||||
* Example:
|
||||
* <p/>
|
||||
* <pre>
|
||||
* <!-- Use all extractors -->
|
||||
* <extractors/>
|
||||
* <!-- Use no extractors -->
|
||||
* <extractors>
|
||||
* <extractor/>
|
||||
* </extractors>
|
||||
* <!-- Use only bsh extractor -->
|
||||
* <extractors>
|
||||
* <extractor>bsh</extractor>
|
||||
* </extractors>
|
||||
* </pre>
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
protected Set/* <String> */extractors;
|
||||
|
||||
protected abstract File getOutputDirectory();
|
||||
|
||||
protected abstract Generator createGenerator();
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
if ( !project.getPackaging().equals( "maven-plugin" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String defaultGoalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() );
|
||||
if ( goalPrefix == null )
|
||||
{
|
||||
goalPrefix = defaultGoalPrefix;
|
||||
}
|
||||
else
|
||||
{
|
||||
getLog().warn(
|
||||
"Goal prefix is: " + goalPrefix + "; Maven currently expects it to be " + defaultGoalPrefix );
|
||||
}
|
||||
|
||||
mojoScanner.setActiveExtractors( extractors );
|
||||
|
||||
// TODO: could use this more, eg in the writing of the plugin descriptor!
|
||||
PluginDescriptor pluginDescriptor = new PluginDescriptor();
|
||||
|
||||
pluginDescriptor.setGroupId( project.getGroupId() );
|
||||
|
||||
pluginDescriptor.setArtifactId( project.getArtifactId() );
|
||||
|
||||
pluginDescriptor.setVersion( project.getVersion() );
|
||||
|
||||
pluginDescriptor.setGoalPrefix( goalPrefix );
|
||||
|
||||
pluginDescriptor.setName( project.getName() );
|
||||
|
||||
pluginDescriptor.setDescription( project.getDescription() );
|
||||
|
||||
try
|
||||
{
|
||||
pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getRuntimeDependencies() ) );
|
||||
|
||||
mojoScanner.populatePluginDescriptor( project, pluginDescriptor );
|
||||
|
||||
getOutputDirectory().mkdirs();
|
||||
|
||||
createGenerator().execute( getOutputDirectory(), pluginDescriptor );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error writing plugin descriptor", e );
|
||||
}
|
||||
catch ( InvalidPluginDescriptorException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'",
|
||||
e );
|
||||
}
|
||||
catch ( ExtractionException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'",
|
||||
e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
package org.apache.maven.plugin.plugin;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Generate a plugin descriptor.
|
||||
* <p/>
|
||||
* Note: Phase is after the "compilation" of any scripts
|
||||
*
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id$
|
||||
* @goal descriptor
|
||||
* @phase generate-resources
|
||||
*/
|
||||
public class DescriptorGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* The directory where the generated plugin.xml file will be put.
|
||||
*
|
||||
* @parameter expression="${project.build.outputDirectory}/META-INF/maven"
|
||||
* @required
|
||||
*/
|
||||
protected File outputDirectory;
|
||||
|
||||
protected File getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
protected Generator createGenerator()
|
||||
{
|
||||
return new PluginDescriptorGenerator();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,278 @@
|
|||
package org.apache.maven.plugin.plugin;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.doxia.sink.Sink;
|
||||
import org.apache.maven.doxia.siterenderer.Renderer;
|
||||
import org.apache.maven.plugin.descriptor.InvalidPluginDescriptorException;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.AbstractMavenReport;
|
||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||
import org.apache.maven.reporting.MavenReportException;
|
||||
import org.apache.maven.tools.plugin.extractor.ExtractionException;
|
||||
import org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginXdocGenerator;
|
||||
import org.apache.maven.tools.plugin.scanner.MojoScanner;
|
||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
/**
|
||||
* Generates the Plugin's documentation report.
|
||||
*
|
||||
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id $
|
||||
* @goal report
|
||||
*/
|
||||
public class PluginReport
|
||||
extends AbstractMavenReport
|
||||
{
|
||||
/**
|
||||
* Report output directory.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}/generated-site/xdoc"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* Doxia Site Renderer.
|
||||
*
|
||||
* @component
|
||||
*/
|
||||
private Renderer siteRenderer;
|
||||
|
||||
/**
|
||||
* The Maven Project.
|
||||
*
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* Mojo scanner tools.
|
||||
*
|
||||
* @component
|
||||
*/
|
||||
protected MojoScanner mojoScanner;
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReport#getSiteRenderer()
|
||||
*/
|
||||
protected Renderer getSiteRenderer()
|
||||
{
|
||||
return siteRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReport#getOutputDirectory()
|
||||
*/
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReport#getProject()
|
||||
*/
|
||||
protected MavenProject getProject()
|
||||
{
|
||||
return project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReport#executeReport(java.util.Locale)
|
||||
*/
|
||||
protected void executeReport( Locale locale )
|
||||
throws MavenReportException
|
||||
{
|
||||
if ( !project.getPackaging().equals( "maven-plugin" ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String goalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() );
|
||||
|
||||
// TODO: could use this more, eg in the writing of the plugin descriptor!
|
||||
PluginDescriptor pluginDescriptor = new PluginDescriptor();
|
||||
|
||||
pluginDescriptor.setGroupId( project.getGroupId() );
|
||||
|
||||
pluginDescriptor.setArtifactId( project.getArtifactId() );
|
||||
|
||||
pluginDescriptor.setVersion( project.getVersion() );
|
||||
|
||||
pluginDescriptor.setGoalPrefix( goalPrefix );
|
||||
|
||||
try
|
||||
{
|
||||
pluginDescriptor.setDependencies( PluginUtils.toComponentDependencies( project.getRuntimeDependencies() ) );
|
||||
|
||||
mojoScanner.populatePluginDescriptor( project, pluginDescriptor );
|
||||
|
||||
// Generate the plugin's documentation
|
||||
generatePluginDocumentation( pluginDescriptor );
|
||||
|
||||
// Write the overview
|
||||
PluginOverviewRenderer r = new PluginOverviewRenderer( getSink(), pluginDescriptor, locale );
|
||||
r.render();
|
||||
}
|
||||
catch ( InvalidPluginDescriptorException e )
|
||||
{
|
||||
throw new MavenReportException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'",
|
||||
e );
|
||||
}
|
||||
catch ( ExtractionException e )
|
||||
{
|
||||
throw new MavenReportException( "Error extracting plugin descriptor: \'" + e.getLocalizedMessage() + "\'",
|
||||
e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.MavenReport#getDescription(java.util.Locale)
|
||||
*/
|
||||
public String getDescription( Locale locale )
|
||||
{
|
||||
return getBundle( locale ).getString( "report.plugin.description" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.MavenReport#getName(java.util.Locale)
|
||||
*/
|
||||
public String getName( Locale locale )
|
||||
{
|
||||
return getBundle( locale ).getString( "report.plugin.name" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.MavenReport#getOutputName()
|
||||
*/
|
||||
public String getOutputName()
|
||||
{
|
||||
return "plugin-info";
|
||||
}
|
||||
|
||||
private void generatePluginDocumentation( PluginDescriptor pluginDescriptor )
|
||||
throws MavenReportException
|
||||
{
|
||||
try
|
||||
{
|
||||
File outputDir = new File( getOutputDirectory() );
|
||||
outputDir.mkdirs();
|
||||
|
||||
Generator generator = new PluginXdocGenerator();
|
||||
generator.execute( outputDir, pluginDescriptor );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MavenReportException( "Error writing plugin documentation", e );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static ResourceBundle getBundle( Locale locale )
|
||||
{
|
||||
return ResourceBundle.getBundle( "plugin-report", locale, PluginReport.class.getClassLoader() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates an overview page with the list of goals
|
||||
* and a link to the goal's page.
|
||||
*/
|
||||
static class PluginOverviewRenderer
|
||||
extends AbstractMavenReportRenderer
|
||||
{
|
||||
private final PluginDescriptor pluginDescriptor;
|
||||
|
||||
private final Locale locale;
|
||||
|
||||
public PluginOverviewRenderer( Sink sink, PluginDescriptor pluginDescriptor, Locale locale )
|
||||
{
|
||||
super( sink );
|
||||
|
||||
this.pluginDescriptor = pluginDescriptor;
|
||||
|
||||
this.locale = locale;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.MavenReportRenderer#getTitle()
|
||||
*/
|
||||
public String getTitle()
|
||||
{
|
||||
return getBundle( locale ).getString( "report.plugin.title" );
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.apache.maven.reporting.AbstractMavenReportRenderer#renderBody()
|
||||
*/
|
||||
public void renderBody()
|
||||
{
|
||||
startSection( getTitle() );
|
||||
|
||||
paragraph( getBundle( locale ).getString( "report.plugin.goals.intro" ) );
|
||||
|
||||
startTable();
|
||||
|
||||
String goalColumnName = getBundle( locale ).getString( "report.plugin.goals.column.goal" );
|
||||
String descriptionColumnName = getBundle( locale ).getString( "report.plugin.goals.column.description" );
|
||||
|
||||
tableHeader( new String[]{goalColumnName, descriptionColumnName} );
|
||||
|
||||
for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
|
||||
{
|
||||
MojoDescriptor mojo = (MojoDescriptor) i.next();
|
||||
|
||||
String goalName = mojo.getFullGoalName();
|
||||
/*
|
||||
* Added ./ to define a relative path
|
||||
* @see AbstractMavenReportRenderer#getValidHref(java.lang.String)
|
||||
*/
|
||||
String goalDocumentationLink = "./" + mojo.getGoal() + "-mojo.html";
|
||||
String description = mojo.getDescription();
|
||||
if ( StringUtils.isEmpty( mojo.getDescription() ) )
|
||||
{
|
||||
description = getBundle( locale ).getString( "report.plugin.goal.nodescription" );
|
||||
|
||||
}
|
||||
|
||||
sink.tableRow();
|
||||
tableCell( createLinkPatternedText( goalName, goalDocumentationLink ) );
|
||||
tableCell( description, true );
|
||||
sink.tableRow_();
|
||||
}
|
||||
|
||||
endTable();
|
||||
|
||||
endSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,205 @@
|
|||
package org.apache.maven.plugin.plugin;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.artifact.ArtifactUtils;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
|
||||
import org.apache.maven.plugin.registry.Plugin;
|
||||
import org.apache.maven.plugin.registry.PluginRegistry;
|
||||
import org.apache.maven.plugin.registry.PluginRegistryUtils;
|
||||
import org.apache.maven.plugin.registry.io.xpp3.PluginRegistryXpp3Writer;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Update the user plugin registry (if it's in use) to reflect the version we're installing.
|
||||
*
|
||||
* @goal updateRegistry
|
||||
* @phase install
|
||||
*/
|
||||
public class UpdatePluginRegistryMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* Indicates whether the plugin-registry.xml is used by Maven or not
|
||||
* to manage plugin versions.
|
||||
*
|
||||
* @parameter default-value="${settings.usePluginRegistry}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private boolean usePluginRegistry;
|
||||
|
||||
/**
|
||||
* The group id of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.groupId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* The artifact id of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.artifactId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* The version of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.artifact.version}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Plexus component for retrieving the plugin registry info.
|
||||
*
|
||||
* @component role="org.apache.maven.plugin.registry.MavenPluginRegistryBuilder"
|
||||
*/
|
||||
private MavenPluginRegistryBuilder pluginRegistryBuilder;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException, MojoFailureException
|
||||
{
|
||||
if ( usePluginRegistry )
|
||||
{
|
||||
updatePluginVersionInRegistry( groupId, artifactId, version );
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePluginVersionInRegistry( String groupId, String artifactId, String version )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
PluginRegistry pluginRegistry;
|
||||
try
|
||||
{
|
||||
pluginRegistry = getPluginRegistry( groupId, artifactId );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Failed to read plugin registry.", e );
|
||||
}
|
||||
catch ( XmlPullParserException e )
|
||||
{
|
||||
throw new MojoExecutionException( "Failed to parse plugin registry.", e );
|
||||
}
|
||||
|
||||
String pluginKey = ArtifactUtils.versionlessKey( groupId, artifactId );
|
||||
Plugin plugin = (Plugin) pluginRegistry.getPluginsByKey().get( pluginKey );
|
||||
|
||||
// if we can find the plugin, but we've gotten here, the useVersion must be missing; fill it in.
|
||||
if ( plugin != null )
|
||||
{
|
||||
if ( PluginRegistry.GLOBAL_LEVEL.equals( plugin.getSourceLevel() ) )
|
||||
{
|
||||
// do nothing. We don't rewrite the globals, under any circumstances.
|
||||
getLog().warn( "Cannot update registered version for plugin {" + groupId + ":" + artifactId +
|
||||
"}; it is specified in the global registry." );
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.setUseVersion( version );
|
||||
|
||||
SimpleDateFormat format =
|
||||
new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT );
|
||||
|
||||
plugin.setLastChecked( format.format( new Date() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin = new org.apache.maven.plugin.registry.Plugin();
|
||||
|
||||
plugin.setGroupId( groupId );
|
||||
plugin.setArtifactId( artifactId );
|
||||
plugin.setUseVersion( version );
|
||||
|
||||
pluginRegistry.addPlugin( plugin );
|
||||
|
||||
pluginRegistry.flushPluginsByKey();
|
||||
}
|
||||
|
||||
writeUserRegistry( groupId, artifactId, pluginRegistry );
|
||||
}
|
||||
|
||||
private void writeUserRegistry( String groupId, String artifactId, PluginRegistry pluginRegistry )
|
||||
{
|
||||
File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile();
|
||||
|
||||
PluginRegistry extractedUserRegistry = PluginRegistryUtils.extractUserPluginRegistry( pluginRegistry );
|
||||
|
||||
// only rewrite the user-level registry if one existed before, or if we've created user-level data here.
|
||||
if ( extractedUserRegistry != null )
|
||||
{
|
||||
FileWriter fWriter = null;
|
||||
|
||||
try
|
||||
{
|
||||
pluginRegistryFile.getParentFile().mkdirs();
|
||||
fWriter = new FileWriter( pluginRegistryFile );
|
||||
|
||||
PluginRegistryXpp3Writer writer = new PluginRegistryXpp3Writer();
|
||||
|
||||
writer.write( fWriter, extractedUserRegistry );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
getLog().warn( "Cannot rewrite user-level plugin-registry.xml with new plugin version of plugin: \'" +
|
||||
groupId + ":" + artifactId + "\'.", e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IOUtil.close( fWriter );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PluginRegistry getPluginRegistry( String groupId, String artifactId )
|
||||
throws IOException, XmlPullParserException
|
||||
{
|
||||
PluginRegistry pluginRegistry = null;
|
||||
|
||||
pluginRegistry = pluginRegistryBuilder.buildPluginRegistry();
|
||||
|
||||
if ( pluginRegistry == null )
|
||||
{
|
||||
pluginRegistry = pluginRegistryBuilder.createUserPluginRegistry();
|
||||
}
|
||||
|
||||
return pluginRegistry;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package org.apache.maven.plugin.plugin;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginXdocGenerator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Generate Xdoc files for the project mojos or goals
|
||||
*
|
||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
* @goal xdoc
|
||||
*/
|
||||
public class XdocGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* The directory where the generated Xdoc files will be put.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}/generated-site/xdoc"
|
||||
* @required
|
||||
*/
|
||||
protected File outputDirectory;
|
||||
|
||||
protected File getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
protected Generator createGenerator()
|
||||
{
|
||||
return new PluginXdocGenerator();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
package org.apache.maven.plugin.plugin.metadata;
|
||||
|
||||
/*
|
||||
* 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 org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.GroupRepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
* Inject any plugin-specific artifact metadata to the project's artifact, for subsequent installation
|
||||
* and deployment. The first use-case for this is to add the LATEST metadata (which is plugin-specific)
|
||||
* for shipping alongside the plugin's artifact.
|
||||
*
|
||||
* @phase package
|
||||
* @goal addPluginArtifactMetadata
|
||||
*/
|
||||
public class AddPluginArtifactMetadataMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
|
||||
/**
|
||||
* The project artifact, which should have the LATEST metadata added to it.
|
||||
*
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* The prefix for the plugin goal.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
private String goalPrefix;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
Artifact projectArtifact = project.getArtifact();
|
||||
|
||||
Versioning versioning = new Versioning();
|
||||
versioning.setLatest( projectArtifact.getVersion() );
|
||||
versioning.updateTimestamp();
|
||||
ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
|
||||
projectArtifact.addMetadata( metadata );
|
||||
|
||||
GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata( project.getGroupId() );
|
||||
groupMetadata.addPluginMapping( getGoalPrefix(), project.getArtifactId(), project.getName() );
|
||||
|
||||
projectArtifact.addMetadata( groupMetadata );
|
||||
}
|
||||
|
||||
private String getGoalPrefix()
|
||||
{
|
||||
if ( goalPrefix == null )
|
||||
{
|
||||
goalPrefix = PluginDescriptor.getGoalPrefixFromArtifactId( project.getArtifactId() );
|
||||
}
|
||||
|
||||
return goalPrefix;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
report.plugin.name=Plugin documentation
|
||||
report.plugin.description=This report provides goals and parameters documentation of a plugin
|
||||
report.plugin.title=Plugin documentation
|
||||
|
||||
report.plugin.goals.intro=Goals available:
|
||||
report.plugin.goals.column.goal=Goal
|
||||
report.plugin.goals.column.description=Description
|
||||
report.plugin.goal.nodescription=No description
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
report.plugin.name=Documentation du plugin
|
||||
report.plugin.description=Ce rapport fournit de la documenations sur les goals et les paramètres d'un plugin
|
||||
report.plugin.title=Documentation du plugin
|
||||
|
||||
report.plugin.goals.intro=Goals disponibles :
|
||||
report.plugin.goals.column.goal=Goal
|
||||
report.plugin.goals.column.description=Description
|
||||
report.plugin.goal.nodescription=Pas de description
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
------
|
||||
Configuring Generation of Plugin Descriptor
|
||||
------
|
||||
Maria Odea Ching
|
||||
------
|
||||
July 2006
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
Configuring Generation of Plugin Descriptor
|
||||
|
||||
To configure the generation of the plugin descriptor, add the following to the project's pom:
|
||||
|
||||
+-----+
|
||||
<project>
|
||||
...
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<configuration>
|
||||
<goalPrefix>plugin</goalPrefix>
|
||||
<outputDirectory>${basedir}/target/dir</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
...
|
||||
</build>
|
||||
...
|
||||
</project>
|
||||
+-----+
|
||||
|
||||
The <<<goalPrefix>>> parameter will set the goal prefix for the plugin that is specified in the descriptor. The <<<outputDirectory>>>
|
||||
parameter, on the other hand, specifies the target location of the generated plugin descriptor.
|
||||
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
------
|
||||
Introduction
|
||||
------
|
||||
Maria Odea Ching
|
||||
------
|
||||
27 July 2006
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
Maven 2 Plugin Plugin
|
||||
|
||||
The Plugin Plugin is used to create a Maven plugin descriptor for any Mojo's found in the source tree, to include in the JAR.
|
||||
It is also used to generate Xdoc files for the Mojos as well as for updating the plugin registry and the artifact metadata.
|
||||
|
||||
* Goals Overview
|
||||
|
||||
The Plugin Plugin has five goals:
|
||||
|
||||
* {{{descriptor-mojo.html}plugin:descriptor}} generates a plugin descriptor.
|
||||
|
||||
* {{{report-mojo.html}plugin:report}} generates the plugin documentation report.
|
||||
|
||||
* {{{updateRegistry-mojo.html}plugin:updateRegistry}} updates the user plugin registry (if it's in use) to reflect the
|
||||
version being installed.
|
||||
|
||||
* {{{xdoc-mojo.html}plugin:xdoc}} generates Xdoc files for the project mojos or goals.
|
||||
|
||||
* {{{addPluginArtifactMetadata-mojo.html}plugin:addPluginArtifactMetadata}} injects any plugin-specific artifact metadata to the project's
|
||||
artifact, for subsequent installation and deployment. The first use-case for this is to add the LATEST metadata
|
||||
(which is plugin-specific) for shipping alongside the plugin's artifact.
|
||||
|
||||
* Usage
|
||||
|
||||
Instructions on how to use the Plugin Plugin can be found {{{usage.html}here}}.
|
||||
|
||||
* Examples
|
||||
|
||||
The following example shows how to use the Plugin Plugin in more advanced usecases:
|
||||
|
||||
* {{{examples/generate-descriptor.html}Configuring Generation of Plugin Descriptor}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
---
|
||||
Multiple Language Support for the Plugin Plugin: Redesign Notes
|
||||
---
|
||||
John Casey
|
||||
---
|
||||
09-Feb-2005
|
||||
---
|
||||
|
||||
~~ 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.
|
||||
|
||||
<<THIS NEEDS REVISION AND CLEANING UP>>
|
||||
|
||||
*Abstract
|
||||
|
||||
The Plugin plugin needs to be refactored in order to support multiple mojo
|
||||
implementation languages. This document will detail the steps needed to
|
||||
add this functionality.
|
||||
|
||||
*Current Status
|
||||
|
||||
The plugin plugin currently calls out to a set of generators in the
|
||||
maven-plugin-tools library, which in turn uses qdox to generate various things
|
||||
based on annotations in the java source code.
|
||||
|
||||
*Refactored Design
|
||||
|
||||
The new design will have a generator-manager which is a component that the
|
||||
plugin mojos will lookup. This component will have access to a mapping of all
|
||||
generators and the language they're registered for. It'll iterate through the
|
||||
mappings, and extract mojo descriptors from all relevant scripts/sources using
|
||||
each language's registered generator. Results from each generator will be
|
||||
centrally aggregated by the generator-manager. After all generators have run,
|
||||
the generator-manager will call another class (depending on what it's meant to
|
||||
produce) to take all the aggregated mojo descriptors and produce a result
|
||||
(such as plugin.xml file for the project).
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
------
|
||||
Usage
|
||||
------
|
||||
Maria Odea Ching
|
||||
------
|
||||
27 July 2006
|
||||
------
|
||||
|
||||
~~ 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.
|
||||
|
||||
Usage
|
||||
|
||||
The Plugin Plugin is generally used for Maven 2 plugins. Its mojos are bound to different phases in the build life cycle.
|
||||
So when you execute a specific phase, the Plugin Plugin mojos bound to it are also executed. Aside from this, each goal can
|
||||
also be explicitly executed from the command line.
|
||||
|
||||
* The <<<plugin:descriptor>>> Goal
|
||||
|
||||
The <<<plugin:descriptor>>> goal is bound to the <<<generate-resources>>> phase. This goal generates the plugin descriptor, which
|
||||
is an xml file that contains information about the plugin.
|
||||
|
||||
For example, you want to create an archive of your plugin and you execute
|
||||
|
||||
+-----+
|
||||
mvn package
|
||||
+-----+
|
||||
|
||||
You will see that the plugin.xml file is generated in the target/classes/META-INF/maven directory of your project. The file is
|
||||
also bundled in the generated jar file.
|
||||
|
||||
To explicitly execute the <<<plugin:descriptor>>> goal, type the following in the command line:
|
||||
|
||||
+-----+
|
||||
mvn plugin:descriptor
|
||||
+-----+
|
||||
|
||||
* The <<<plugin:xdoc>>> Goal
|
||||
|
||||
To generate Xdoc files for the mojos of your plugin, execute the following on the command line:
|
||||
|
||||
+-----+
|
||||
mvn plugin:xdoc
|
||||
+-----+
|
||||
|
||||
* The <<<plugin:updateRegistry>>> Goal
|
||||
|
||||
The <<<plugin:updateRegistry>>> goal is bound to the <<<install>>> phase of the build life cycle. This goal updates the
|
||||
plugin registry to reflect the changes in the version of the plugin you're installing in your local repository.
|
||||
|
||||
So when you execute
|
||||
|
||||
+-----+
|
||||
mvn install
|
||||
+-----+
|
||||
|
||||
you will see that the version of the plugin in the plugin-registry.xml is changed to the same version of the plugin
|
||||
that you have just installed.
|
||||
|
||||
You can also explicitly execute the <<<plugin:updateRegistry>>> goal by executing
|
||||
|
||||
+-----+
|
||||
mvn plugin:updateRegistry
|
||||
+-----+
|
||||
|
||||
from the command line.
|
||||
|
||||
* The <<<plugin:addPluginArtifactMetadata>>> Goal
|
||||
|
||||
The <<<plugin:addPluginArtifactMetadata>>> goal, on the other hand, is bound to the <<<package>>> phase of the build life cycle.
|
||||
This goal will add the metadata to the project artifact. To do this, execute
|
||||
|
||||
+-----+
|
||||
mvn package
|
||||
+-----+
|
||||
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<faqs id="FAQ" title="Frequently Asked Questions">
|
||||
<part id="General">
|
||||
<faq id="Where is the plugin-registry.xml">
|
||||
<question>Where is the plugin-registry.xml?</question>
|
||||
<answer>
|
||||
<p>
|
||||
The plugin-registry.xml file can be found in the M2 repository, inside the .m2 directory. It contains the
|
||||
list of the plugins installed in your repository including the last version installed.
|
||||
</p>
|
||||
</answer>
|
||||
</faq>
|
||||
</part>
|
||||
</faqs>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project name="Maven Plugin Plugin">
|
||||
<body>
|
||||
|
||||
<menu name="Overview">
|
||||
<item name="Introduction" href="index.html"/>
|
||||
<item name="Goals" href="plugin-info.html"/>
|
||||
<item name="Usage" href="usage.html"/>
|
||||
<item name="FAQ" href="faq.html"/>
|
||||
</menu>
|
||||
|
||||
<menu name="Examples">
|
||||
<item name="Configuring Generation of Plugin Descriptor" href="/examples/generate-descriptor.html"/>
|
||||
</menu>
|
||||
|
||||
<menu name="Developers">
|
||||
<item name="Multiple Language Support: Redesign Notes" href="multiple-language-support.html"/>
|
||||
</menu>
|
||||
</body>
|
||||
</project>
|
||||
|
||||
Loading…
Reference in New Issue