o fixed checkstyle + updated javadoc
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@684232 13f79535-47bb-0310-9956-ffa450edef68master
parent
e798f33a69
commit
fa601065d6
|
|
@ -34,6 +34,8 @@ import java.io.IOException;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Abstract class for this Plugin.
|
||||||
|
*
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
@ -89,8 +91,14 @@ public abstract class AbstractGeneratorMojo
|
||||||
*/
|
*/
|
||||||
protected Set/* <String> */extractors;
|
protected Set/* <String> */extractors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the output directory where files will be generated.
|
||||||
|
*/
|
||||||
protected abstract File getOutputDirectory();
|
protected abstract File getOutputDirectory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the wanted <code>Generator</code> implementation.
|
||||||
|
*/
|
||||||
protected abstract Generator createGenerator();
|
protected abstract Generator createGenerator();
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
|
|
|
||||||
|
|
@ -220,6 +220,11 @@ public class PluginReport
|
||||||
return "plugin-info";
|
return "plugin-info";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pluginDescriptor not null
|
||||||
|
* @param locale not null
|
||||||
|
* @throws MavenReportException if any
|
||||||
|
*/
|
||||||
private void generatePluginDocumentation( PluginDescriptor pluginDescriptor, Locale locale )
|
private void generatePluginDocumentation( PluginDescriptor pluginDescriptor, Locale locale )
|
||||||
throws MavenReportException
|
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 )
|
protected static ResourceBundle getBundle( Locale locale )
|
||||||
{
|
{
|
||||||
return ResourceBundle.getBundle( "plugin-report", locale, PluginReport.class.getClassLoader() );
|
return ResourceBundle.getBundle( "plugin-report", locale, PluginReport.class.getClassLoader() );
|
||||||
|
|
@ -258,6 +267,13 @@ public class PluginReport
|
||||||
|
|
||||||
private final Locale locale;
|
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,
|
public PluginOverviewRenderer( MavenProject project, Requirements requirements, Sink sink,
|
||||||
PluginDescriptor pluginDescriptor, Locale locale )
|
PluginDescriptor pluginDescriptor, Locale locale )
|
||||||
{
|
{
|
||||||
|
|
@ -512,8 +528,8 @@ public class PluginReport
|
||||||
* Try to lookup on the Maven prerequisites property.
|
* Try to lookup on the Maven prerequisites property.
|
||||||
* If not specified, uses the value defined by the user.
|
* If not specified, uses the value defined by the user.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project not null
|
||||||
* @param requirements
|
* @param requirements not null
|
||||||
* @return the Maven version
|
* @return the Maven version
|
||||||
*/
|
*/
|
||||||
private static String discoverMavenRequirement( MavenProject project, Requirements requirements )
|
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 defined by the user.
|
||||||
* If not specified, uses the value of the system property <code>java.specification.version</code>.
|
* If not specified, uses the value of the system property <code>java.specification.version</code>.
|
||||||
*
|
*
|
||||||
* @param project
|
* @param project not null
|
||||||
* @param requirements
|
* @param requirements not null
|
||||||
* @return the JDK version
|
* @return the JDK version
|
||||||
*/
|
*/
|
||||||
private static String discoverJdkRequirement( MavenProject project, Requirements requirements )
|
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 <code>target</code> in the configuration of <code>maven-compiler-plugin</code>.
|
* @return the value of the <code>target</code> in the configuration of <code>maven-compiler-plugin</code>.
|
||||||
*/
|
*/
|
||||||
private static String discoverJdkRequirementFromPlugins( Map pluginsAsMap )
|
private static String discoverJdkRequirementFromPlugins( Map pluginsAsMap )
|
||||||
|
|
|
||||||
|
|
@ -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.
|
* Update the user plugin registry (if it's in use) to reflect the version we're installing.
|
||||||
*
|
*
|
||||||
|
* @version $Id$
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
* @goal updateRegistry
|
* @goal updateRegistry
|
||||||
* @phase install
|
* @phase install
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
public class UpdatePluginRegistryMojo
|
public class UpdatePluginRegistryMojo
|
||||||
extends AbstractMojo
|
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
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
PluginRegistry pluginRegistry;
|
PluginRegistry pluginRegistry;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pluginRegistry = getPluginRegistry( groupId, artifactId );
|
pluginRegistry = getPluginRegistry( aGroupId, anArtifactId );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
|
|
@ -121,7 +127,7 @@ public class UpdatePluginRegistryMojo
|
||||||
throw new MojoExecutionException( "Failed to parse plugin registry.", e );
|
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 );
|
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 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() ) )
|
if ( TrackableBase.GLOBAL_LEVEL.equals( plugin.getSourceLevel() ) )
|
||||||
{
|
{
|
||||||
// do nothing. We don't rewrite the globals, under any circumstances.
|
// 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." );
|
+ "}; it is specified in the global registry." );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugin.setUseVersion( version );
|
plugin.setUseVersion( aVersion );
|
||||||
|
|
||||||
SimpleDateFormat format =
|
SimpleDateFormat format =
|
||||||
new SimpleDateFormat( org.apache.maven.plugin.registry.Plugin.LAST_CHECKED_DATE_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 = new org.apache.maven.plugin.registry.Plugin();
|
||||||
|
|
||||||
plugin.setGroupId( groupId );
|
plugin.setGroupId( aGroupId );
|
||||||
plugin.setArtifactId( artifactId );
|
plugin.setArtifactId( anArtifactId );
|
||||||
plugin.setUseVersion( version );
|
plugin.setUseVersion( aVersion );
|
||||||
|
|
||||||
pluginRegistry.addPlugin( plugin );
|
pluginRegistry.addPlugin( plugin );
|
||||||
|
|
||||||
pluginRegistry.flushPluginsByKey();
|
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();
|
File pluginRegistryFile = pluginRegistry.getRuntimeInfo().getFile();
|
||||||
|
|
||||||
|
|
@ -182,7 +193,7 @@ public class UpdatePluginRegistryMojo
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
getLog().warn( "Cannot rewrite user-level plugin-registry.xml with new plugin version of plugin: \'"
|
getLog().warn( "Cannot rewrite user-level plugin-registry.xml with new plugin version of plugin: \'"
|
||||||
+ groupId + ":" + artifactId + "\'.", e );
|
+ aGroupId + ":" + anArtifactId + "\'.", e );
|
||||||
}
|
}
|
||||||
finally
|
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
|
throws IOException, XmlPullParserException
|
||||||
{
|
{
|
||||||
PluginRegistry pluginRegistry = null;
|
PluginRegistry pluginRegistry = null;
|
||||||
|
|
@ -205,5 +223,4 @@ public class UpdatePluginRegistryMojo
|
||||||
|
|
||||||
return pluginRegistry;
|
return pluginRegistry;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
* 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.
|
* for shipping alongside the plugin's artifact.
|
||||||
*
|
*
|
||||||
|
* @version $Id$
|
||||||
* @since 2.0
|
* @since 2.0
|
||||||
* @phase package
|
* @phase package
|
||||||
* @goal addPluginArtifactMetadata
|
* @goal addPluginArtifactMetadata
|
||||||
|
|
@ -40,7 +41,6 @@ import org.apache.maven.project.MavenProject;
|
||||||
public class AddPluginArtifactMetadataMojo
|
public class AddPluginArtifactMetadataMojo
|
||||||
extends AbstractMojo
|
extends AbstractMojo
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The project artifact, which should have the LATEST metadata added to it.
|
* The project artifact, which should have the LATEST metadata added to it.
|
||||||
*
|
*
|
||||||
|
|
@ -57,6 +57,7 @@ public class AddPluginArtifactMetadataMojo
|
||||||
*/
|
*/
|
||||||
private String goalPrefix;
|
private String goalPrefix;
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
public void execute()
|
public void execute()
|
||||||
throws MojoExecutionException
|
throws MojoExecutionException
|
||||||
{
|
{
|
||||||
|
|
@ -74,6 +75,9 @@ public class AddPluginArtifactMetadataMojo
|
||||||
projectArtifact.addMetadata( groupMetadata );
|
projectArtifact.addMetadata( groupMetadata );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the goal prefix parameter or the goal prefix from the Plugin artifactId.
|
||||||
|
*/
|
||||||
private String getGoalPrefix()
|
private String getGoalPrefix()
|
||||||
{
|
{
|
||||||
if ( goalPrefix == null )
|
if ( goalPrefix == null )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue