From fa601065d66a7b8ddd39591a921c44b9d7db09f6 Mon Sep 17 00:00:00 2001 From: Vincent Siveton Date: Sat, 9 Aug 2008 12:08:18 +0000 Subject: [PATCH] o fixed checkstyle + updated javadoc git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@684232 13f79535-47bb-0310-9956-ffa450edef68 --- .../plugin/plugin/AbstractGeneratorMojo.java | 8 ++++ .../maven/plugin/plugin/PluginReport.java | 28 +++++++++--- .../plugin/UpdatePluginRegistryMojo.java | 45 +++++++++++++------ .../AddPluginArtifactMetadataMojo.java | 6 ++- 4 files changed, 66 insertions(+), 21 deletions(-) diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java index 56c5c04..2f77aa0 100644 --- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java +++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/AbstractGeneratorMojo.java @@ -34,6 +34,8 @@ import java.io.IOException; import java.util.Set; /** + * Abstract class for this Plugin. + * * @author Jason van Zyl * @version $Id$ */ @@ -89,8 +91,14 @@ public abstract class AbstractGeneratorMojo */ protected Set/* */extractors; + /** + * @return the output directory where files will be generated. + */ protected abstract File getOutputDirectory(); + /** + * @return the wanted Generator implementation. + */ protected abstract Generator createGenerator(); /** {@inheritDoc} */ diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java index c92037b..b02d0de 100644 --- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java +++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/PluginReport.java @@ -220,6 +220,11 @@ public class PluginReport return "plugin-info"; } + /** + * @param pluginDescriptor not null + * @param locale not null + * @throws MavenReportException if any + */ private void generatePluginDocumentation( PluginDescriptor pluginDescriptor, Locale locale ) throws MavenReportException { @@ -238,6 +243,10 @@ public class PluginReport } + /** + * @param locale not null + * @return the bundle for this report + */ protected static ResourceBundle getBundle( Locale locale ) { return ResourceBundle.getBundle( "plugin-report", locale, PluginReport.class.getClassLoader() ); @@ -258,6 +267,13 @@ public class PluginReport private final Locale locale; + /** + * @param project not null + * @param requirements not null + * @param sink not null + * @param pluginDescriptor not null + * @param locale not null + */ public PluginOverviewRenderer( MavenProject project, Requirements requirements, Sink sink, PluginDescriptor pluginDescriptor, Locale locale ) { @@ -431,7 +447,7 @@ public class PluginReport /** * Render the section about the usage of the plugin. - * + * * @param hasMavenReport If the plugin has a report or not */ private void renderUsageSection( boolean hasMavenReport ) @@ -512,8 +528,8 @@ public class PluginReport * Try to lookup on the Maven prerequisites property. * If not specified, uses the value defined by the user. * - * @param project - * @param requirements + * @param project not null + * @param requirements not null * @return the Maven version */ private static String discoverMavenRequirement( MavenProject project, Requirements requirements ) @@ -537,8 +553,8 @@ public class PluginReport * If not specified, uses the value defined by the user. * If not specified, uses the value of the system property java.specification.version. * - * @param project - * @param requirements + * @param project not null + * @param requirements not null * @return the JDK version */ private static String discoverJdkRequirement( MavenProject project, Requirements requirements ) @@ -565,7 +581,7 @@ public class PluginReport } /** - * @param pluginsAsMap + * @param pluginsAsMap could be null * @return the value of the target in the configuration of maven-compiler-plugin. */ private static String discoverJdkRequirementFromPlugins( Map pluginsAsMap ) diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java index d8f3bd2..a04e667 100644 --- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java +++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/UpdatePluginRegistryMojo.java @@ -42,10 +42,10 @@ import java.util.Date; /** * Update the user plugin registry (if it's in use) to reflect the version we're installing. * + * @version $Id$ * @since 2.0 * @goal updateRegistry * @phase install - * @version $Id$ */ public class UpdatePluginRegistryMojo extends AbstractMojo @@ -104,13 +104,19 @@ public class UpdatePluginRegistryMojo } } - private void updatePluginVersionInRegistry( String groupId, String artifactId, String version ) + /** + * @param aGroupId not null + * @param anArtifactId not null + * @param aVersion not null + * @throws MojoExecutionException if any + */ + private void updatePluginVersionInRegistry( String aGroupId, String anArtifactId, String aVersion ) throws MojoExecutionException { PluginRegistry pluginRegistry; try { - pluginRegistry = getPluginRegistry( groupId, artifactId ); + pluginRegistry = getPluginRegistry( aGroupId, anArtifactId ); } catch ( IOException e ) { @@ -121,7 +127,7 @@ public class UpdatePluginRegistryMojo throw new MojoExecutionException( "Failed to parse plugin registry.", e ); } - String pluginKey = ArtifactUtils.versionlessKey( groupId, artifactId ); + String pluginKey = ArtifactUtils.versionlessKey( aGroupId, anArtifactId ); 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. @@ -130,12 +136,12 @@ public class UpdatePluginRegistryMojo if ( TrackableBase.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 + getLog().warn( "Cannot update registered version for plugin {" + aGroupId + ":" + anArtifactId + "}; it is specified in the global registry." ); } else { - plugin.setUseVersion( version ); + plugin.setUseVersion( aVersion ); SimpleDateFormat format = new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_FORMAT ); @@ -147,19 +153,24 @@ public class UpdatePluginRegistryMojo { plugin = new org.apache.maven.plugin.registry.Plugin(); - plugin.setGroupId( groupId ); - plugin.setArtifactId( artifactId ); - plugin.setUseVersion( version ); + plugin.setGroupId( aGroupId ); + plugin.setArtifactId( anArtifactId ); + plugin.setUseVersion( aVersion ); pluginRegistry.addPlugin( plugin ); pluginRegistry.flushPluginsByKey(); } - writeUserRegistry( groupId, artifactId, pluginRegistry ); + writeUserRegistry( aGroupId, anArtifactId, pluginRegistry ); } - private void writeUserRegistry( String groupId, String artifactId, PluginRegistry pluginRegistry ) + /** + * @param aGroupId not null + * @param anArtifactId not null + * @param pluginRegistry not null + */ + private void writeUserRegistry( String aGroupId, String anArtifactId, PluginRegistry pluginRegistry ) { File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile(); @@ -182,7 +193,7 @@ public class UpdatePluginRegistryMojo catch ( IOException e ) { getLog().warn( "Cannot rewrite user-level plugin-registry.xml with new plugin version of plugin: \'" - + groupId + ":" + artifactId + "\'.", e ); + + aGroupId + ":" + anArtifactId + "\'.", e ); } finally { @@ -191,7 +202,14 @@ public class UpdatePluginRegistryMojo } } - private PluginRegistry getPluginRegistry( String groupId, String artifactId ) + /** + * @param aGroupId not null + * @param anArtifactId not null + * @return the plugin registry instance + * @throws IOException if any + * @throws XmlPullParserException if any + */ + private PluginRegistry getPluginRegistry( String aGroupId, String anArtifactId ) throws IOException, XmlPullParserException { PluginRegistry pluginRegistry = null; @@ -205,5 +223,4 @@ public class UpdatePluginRegistryMojo return pluginRegistry; } - } diff --git a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java index 04439ad..acdde91 100644 --- a/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java +++ b/maven-plugin-plugin/src/main/java/org/apache/maven/plugin/plugin/metadata/AddPluginArtifactMetadataMojo.java @@ -33,6 +33,7 @@ import org.apache.maven.project.MavenProject; * 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. * + * @version $Id$ * @since 2.0 * @phase package * @goal addPluginArtifactMetadata @@ -40,7 +41,6 @@ import org.apache.maven.project.MavenProject; public class AddPluginArtifactMetadataMojo extends AbstractMojo { - /** * The project artifact, which should have the LATEST metadata added to it. * @@ -57,6 +57,7 @@ public class AddPluginArtifactMetadataMojo */ private String goalPrefix; + /** {@inheritDoc} */ public void execute() throws MojoExecutionException { @@ -74,6 +75,9 @@ public class AddPluginArtifactMetadataMojo projectArtifact.addMetadata( groupMetadata ); } + /** + * @return the goal prefix parameter or the goal prefix from the Plugin artifactId. + */ private String getGoalPrefix() { if ( goalPrefix == null )