[MPLUGIN-209] use maven-plugin-tools' java 5 annotations
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@1345787 13f79535-47bb-0310-9956-ffa450edef68master
parent
d3bf47a4f3
commit
7230ba93e3
|
|
@ -45,10 +45,16 @@
|
|||
<doxiaVersion>1.2</doxiaVersion>
|
||||
<doxia-sitetoolsVersion>1.2</doxia-sitetoolsVersion>
|
||||
<it.debug>true</it.debug>
|
||||
<mavenPluginPluginVersion>2.9</mavenPluginPluginVersion>
|
||||
<mavenPluginPluginVersion>3.0</mavenPluginPluginVersion>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||
<artifactId>maven-plugin-tools-annotations</artifactId>
|
||||
<version>${mavenPluginPluginVersion}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- doxia -->
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.doxia</groupId>
|
||||
|
|
@ -238,7 +244,16 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-plugin-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>mojo-descriptor</id>
|
||||
<goals>
|
||||
<goal>descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>generated-helpmojo</id>
|
||||
<goals>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ 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.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.tools.plugin.DefaultPluginToolsRequest;
|
||||
import org.apache.maven.tools.plugin.PluginToolsRequest;
|
||||
|
|
@ -44,41 +46,34 @@ import java.util.Set;
|
|||
*
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id$
|
||||
* @threadSafe
|
||||
*/
|
||||
public abstract class AbstractGeneratorMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* The project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Component
|
||||
protected MavenProject project;
|
||||
|
||||
/**
|
||||
* The component used for scanning the source tree for mojos.
|
||||
*
|
||||
* @component
|
||||
* @required
|
||||
*/
|
||||
@Component
|
||||
protected MojoScanner mojoScanner;
|
||||
|
||||
/**
|
||||
* The file encoding of the source files.
|
||||
*
|
||||
* @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}"
|
||||
* @since 2.5
|
||||
*/
|
||||
@Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
|
||||
protected String encoding;
|
||||
|
||||
/**
|
||||
* The goal prefix that will appear before the ":".
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
protected String goalPrefix;
|
||||
|
||||
/**
|
||||
|
|
@ -86,9 +81,9 @@ public abstract class AbstractGeneratorMojo
|
|||
* descriptor generator mojo is bound to generate-resources phase.
|
||||
* But for annotations, the compiled classes are needed, so skip error
|
||||
*
|
||||
* @parameter expression="${maven.plugin.skipErrorNoDescriptorsFound}" default-value="false"
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( property = "maven.plugin.skipErrorNoDescriptorsFound", defaultValue = "false" )
|
||||
protected boolean skipErrorNoDescriptorsFound;
|
||||
|
||||
/**
|
||||
|
|
@ -113,47 +108,40 @@ public abstract class AbstractGeneratorMojo
|
|||
* <extractor>bsh</extractor>
|
||||
* </extractors>
|
||||
* </pre>
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
protected Set<String> extractors;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip invoking any goals or reports of the plugin.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.skip" )
|
||||
protected boolean skip;
|
||||
|
||||
/**
|
||||
* The set of dependencies for the current project
|
||||
*
|
||||
* @parameter default-value = "${project.artifacts}"
|
||||
* @required
|
||||
* @readonly
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.artifacts}", required = true, readonly = true )
|
||||
protected Set<Artifact> dependencies;
|
||||
|
||||
/**
|
||||
* List of Remote Repositories used by the resolver
|
||||
*
|
||||
* @parameter expression="${project.remoteArtifactRepositories}"
|
||||
* @readonly
|
||||
* @required
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
|
||||
protected List<ArtifactRepository> remoteRepos;
|
||||
|
||||
/**
|
||||
* Location of the local repository.
|
||||
*
|
||||
* @parameter expression="${localRepository}"
|
||||
* @readonly
|
||||
* @required
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
|
||||
protected ArtifactRepository local;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ package org.apache.maven.plugin.plugin;
|
|||
*/
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.plugins.annotations.ResolutionScope;
|
||||
import org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginDescriptorGenerator;
|
||||
|
||||
|
|
@ -34,26 +38,24 @@ import java.io.File;
|
|||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||
* @version $Id$
|
||||
* @since 2.0
|
||||
* @goal descriptor
|
||||
* @phase process-classes
|
||||
* @requiresDependencyResolution runtime
|
||||
*/
|
||||
@Mojo( name = "descriptor", defaultPhase = LifecyclePhase.PROCESS_CLASSES,
|
||||
requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true )
|
||||
public class DescriptorGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* The directory where the generated <code>plugin.xml</code> file will be put.
|
||||
*
|
||||
* @parameter default-value="${project.build.outputDirectory}/META-INF/maven"
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.build.outputDirectory}/META-INF/maven" )
|
||||
protected File outputDirectory;
|
||||
|
||||
/**
|
||||
* A flag to disable generation of the <code>plugin.xml</code> in favor of a hand authored plugin descriptor.
|
||||
*
|
||||
* @parameter default-value="false"
|
||||
* @since 2.6
|
||||
*/
|
||||
@Parameter( defaultValue = "false" )
|
||||
private boolean skipDescriptor;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ package org.apache.maven.plugin.plugin;
|
|||
*/
|
||||
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginHelpGenerator;
|
||||
import org.codehaus.plexus.velocity.VelocityComponent;
|
||||
|
|
@ -31,36 +35,31 @@ import java.io.File;
|
|||
*
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
* @goal helpmojo
|
||||
* @phase generate-sources
|
||||
* @since 2.4
|
||||
*/
|
||||
@Mojo( name = "helpmojo", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true )
|
||||
public class HelpGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* The directory where the generated <code>HelpMojo</code> file will be put.
|
||||
*
|
||||
* @parameter default-value="${project.build.directory}/generated-sources/plugin"
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.build.directory}/generated-sources/plugin" )
|
||||
protected File outputDirectory;
|
||||
|
||||
/**
|
||||
* The name of the package for the generated <code>HelpMojo</code>. By default, the package will be calculated based
|
||||
* on the packages of the other plugin goals.
|
||||
*
|
||||
* @parameter
|
||||
* @since 2.6
|
||||
*/
|
||||
@Parameter
|
||||
private String helpPackageName;
|
||||
|
||||
/**
|
||||
* Velocity component.
|
||||
*
|
||||
* @component
|
||||
* @readonly
|
||||
* @required
|
||||
*/
|
||||
@Component
|
||||
private VelocityComponent velocity;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ import org.apache.maven.model.ReportPlugin;
|
|||
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.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.Execute;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.AbstractMavenReport;
|
||||
import org.apache.maven.reporting.AbstractMavenReportRenderer;
|
||||
|
|
@ -58,52 +63,45 @@ import java.util.Set;
|
|||
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
|
||||
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
|
||||
* @version $Id$
|
||||
* @goal report
|
||||
* @execute phase="process-classes"
|
||||
* @since 2.0
|
||||
*/
|
||||
@Mojo( name = "report", threadSafe = true )
|
||||
@Execute( phase = LifecyclePhase.PROCESS_CLASSES )
|
||||
public class PluginReport
|
||||
extends AbstractMavenReport
|
||||
{
|
||||
/**
|
||||
* Report output directory.
|
||||
*
|
||||
* @parameter default-value="${project.build.directory}/generated-site/xdoc"
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.build.directory}/generated-site/xdoc" )
|
||||
private File outputDirectory;
|
||||
|
||||
/**
|
||||
* Doxia Site Renderer.
|
||||
*
|
||||
* @component
|
||||
*/
|
||||
@Component
|
||||
private Renderer siteRenderer;
|
||||
|
||||
/**
|
||||
* The Maven Project.
|
||||
*
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Component
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* Mojo scanner tools.
|
||||
*
|
||||
* @component
|
||||
*/
|
||||
@Component
|
||||
protected MojoScanner mojoScanner;
|
||||
|
||||
/**
|
||||
* The file encoding of the source files.
|
||||
*
|
||||
* @parameter expression="${encoding}" default-value="${project.build.sourceEncoding}"
|
||||
* @since 2.7
|
||||
*/
|
||||
@Parameter( property = "encoding", defaultValue = "${project.build.sourceEncoding}" )
|
||||
private String encoding;
|
||||
|
||||
|
||||
/**
|
||||
* Specify some requirements to execute this plugin.
|
||||
* Example:
|
||||
|
|
@ -121,9 +119,8 @@ public class PluginReport
|
|||
* </others>
|
||||
* </requirements>
|
||||
* </pre>
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
private Requirements requirements;
|
||||
|
||||
/**
|
||||
|
|
@ -140,55 +137,49 @@ public class PluginReport
|
|||
* (There is a special for maven-plugin-plugin; it is mapped to 'plugin'.
|
||||
* </p>
|
||||
*
|
||||
* @parameter expression="${goalPrefix}"
|
||||
* @since 2.4
|
||||
*/
|
||||
@Parameter( property = "goalPrefix" )
|
||||
protected String goalPrefix;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip invoking any goals or reports of the plugin.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.skip" )
|
||||
private boolean skip;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip generating the report.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.report.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.report.skip" )
|
||||
private boolean skipReport;
|
||||
|
||||
/**
|
||||
* The set of dependencies for the current project
|
||||
*
|
||||
* @parameter default-value = "${project.artifacts}"
|
||||
* @required
|
||||
* @readonly
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.artifacts}", required = true, readonly = true )
|
||||
protected Set<Artifact> dependencies;
|
||||
|
||||
/**
|
||||
* List of Remote Repositories used by the resolver
|
||||
*
|
||||
* @parameter expression="${project.remoteArtifactRepositories}"
|
||||
* @readonly
|
||||
* @required
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.remoteArtifactRepositories}", required = true, readonly = true )
|
||||
protected List<ArtifactRepository> remoteRepos;
|
||||
|
||||
/**
|
||||
* Location of the local repository.
|
||||
*
|
||||
* @parameter expression="${localRepository}"
|
||||
* @readonly
|
||||
* @required
|
||||
* @since 3.0
|
||||
*/
|
||||
@Parameter( defaultValue = "${localRepository}", required = true, readonly = true )
|
||||
protected ArtifactRepository local;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ import org.apache.maven.plugin.registry.PluginRegistry;
|
|||
import org.apache.maven.plugin.registry.PluginRegistryUtils;
|
||||
import org.apache.maven.plugin.registry.TrackableBase;
|
||||
import org.apache.maven.plugin.registry.io.xpp3.PluginRegistryXpp3Writer;
|
||||
import org.apache.maven.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.codehaus.plexus.util.IOUtil;
|
||||
import org.codehaus.plexus.util.WriterFactory;
|
||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||
|
|
@ -44,70 +48,56 @@ import java.util.Date;
|
|||
*
|
||||
* @version $Id$
|
||||
* @since 2.0
|
||||
* @goal updateRegistry
|
||||
* @phase install
|
||||
*/
|
||||
@Mojo( name = "updateRegistry", defaultPhase = LifecyclePhase.INSTALL, threadSafe = true )
|
||||
public class UpdatePluginRegistryMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* Indicates whether the <code>plugin-registry.xml</code> file is used by Maven or not
|
||||
* to manage plugin versions.
|
||||
*
|
||||
* @parameter default-value="${settings.usePluginRegistry}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Parameter( defaultValue = "${settings.usePluginRegistry}", required = true, readonly = true )
|
||||
private boolean usePluginRegistry;
|
||||
|
||||
/**
|
||||
* The group id of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.groupId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.groupId}", required = true, readonly = true )
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* The artifact id of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.artifactId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.artifactId}", required = true, readonly = true )
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* The version of the project currently being built.
|
||||
*
|
||||
* @parameter default-value="${project.artifact.version}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.artifact.version}", required = true, readonly = true )
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* Plexus component for retrieving the plugin registry info.
|
||||
*
|
||||
* @component role="org.apache.maven.plugin.registry.MavenPluginRegistryBuilder"
|
||||
*/
|
||||
@Component
|
||||
private MavenPluginRegistryBuilder pluginRegistryBuilder;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip invoking any goals or reports of the plugin.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.skip" )
|
||||
private boolean skip;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip updating the plugin registry.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.update.registry.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.update.registry.skip" )
|
||||
private boolean skipUpdatePluginRegistry;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@ package org.apache.maven.plugin.plugin;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.tools.plugin.generator.Generator;
|
||||
import org.apache.maven.tools.plugin.generator.PluginXdocGenerator;
|
||||
|
||||
|
|
@ -30,16 +32,15 @@ import java.io.File;
|
|||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||
* @version $Id$
|
||||
* @since 2.0
|
||||
* @goal xdoc
|
||||
*/
|
||||
@Mojo( name = "xdoc", threadSafe = true )
|
||||
public class XdocGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* The directory where the generated Xdoc files will be put.
|
||||
*
|
||||
* @parameter default-value="${project.build.directory}/generated-site/xdoc"
|
||||
*/
|
||||
@Parameter( defaultValue = "${project.build.directory}/generated-site/xdoc" )
|
||||
protected File outputDirectory;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
|
|
@ -26,6 +26,10 @@ 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.plugins.annotations.Component;
|
||||
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||
import org.apache.maven.plugins.annotations.Mojo;
|
||||
import org.apache.maven.plugins.annotations.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
/**
|
||||
|
|
@ -42,35 +46,29 @@ import org.apache.maven.project.MavenProject;
|
|||
* @see GroupRepositoryMetadata
|
||||
* @version $Id$
|
||||
* @since 2.0
|
||||
* @phase package
|
||||
* @goal addPluginArtifactMetadata
|
||||
* @threadSafe
|
||||
*/
|
||||
@Mojo( name = "addPluginArtifactMetadata", defaultPhase = LifecyclePhase.PACKAGE, threadSafe = true )
|
||||
public class AddPluginArtifactMetadataMojo
|
||||
extends AbstractMojo
|
||||
{
|
||||
/**
|
||||
* The project artifact, which should have the <code>latest</code> metadata added to it.
|
||||
*
|
||||
* @parameter default-value="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
@Component
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* The prefix for the plugin goal.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
@Parameter
|
||||
private String goalPrefix;
|
||||
|
||||
/**
|
||||
* Set this to "true" to skip invoking any goals or reports of the plugin.
|
||||
*
|
||||
* @parameter default-value="false" expression="${maven.plugin.skip}"
|
||||
* @since 2.8
|
||||
*/
|
||||
@Parameter( defaultValue = "false", property = "maven.plugin.skip" )
|
||||
private boolean skip;
|
||||
|
||||
/** {@inheritDoc} */
|
||||
|
|
|
|||
Loading…
Reference in New Issue