mirror of https://github.com/apache/maven.git
o Cleaned up field-level annotation support (especially descriptor extraction, generation, and building)
o Converted all "core" plugins (including maven-core-it-plugin) to use field-level annotations o Removed generation of parameter descriptors for ${/#component.* param specifications. o Added @readonly for parameters that cannot be overridden by user configuration (List override was dangerous here) o Added validation against pom-derived configuration for @readonly parameters o Fixed @parameter alias="" support...now configuration of the mojo instance actually will work with either the real param name or the alias. Would be nice to support multiple aliases, but that might require @alias annotations... o Added [temporary?] support for null editable attributes for parameters, to support pre-built mojos from the repo. Annotation support should be just about ready to go... git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@165224 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
742a8e7037
commit
ab91b7f4c2
|
@ -29,36 +29,30 @@ import java.io.FileWriter;
|
|||
* @phase process-sources
|
||||
*
|
||||
* @description Goal which cleans the build
|
||||
*
|
||||
* @parameter
|
||||
* name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
*
|
||||
* @parameter
|
||||
* name="basedirAlignmentDirectory"
|
||||
* type="java.io.File"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="target/test-basedir-alignment"
|
||||
* description=""
|
||||
*
|
||||
* @parameter name="pluginItem" type="String" required="false" validator="" description="" expression="" defaultValue="foo"
|
||||
* @parameter name="goalItem" type="String" required="false" validator="" description="" expression="bar"
|
||||
*/
|
||||
public class CoreItMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="target/test-basedir-alignment"
|
||||
*/
|
||||
private File basedirAlignmentDirectory;
|
||||
|
||||
private String pluginItem;
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private String pluginItem = "foo";
|
||||
|
||||
private String goalItem;
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private String goalItem = "bar";
|
||||
|
||||
public void execute()
|
||||
throws PluginExecutionException
|
||||
|
|
|
@ -228,8 +228,8 @@ public class DefaultPluginManager
|
|||
if ( StringUtils.isEmpty( pluginConfig.getVersion() ) )
|
||||
{
|
||||
// The model/project builder should have validated this already
|
||||
String message = "The maven plugin with groupId: '" + groupId + "' and artifactId: '" + artifactId +
|
||||
"' which was configured for use in this project does not have a version associated with it.";
|
||||
String message = "The maven plugin with groupId: '" + groupId + "' and artifactId: '" + artifactId
|
||||
+ "' which was configured for use in this project does not have a version associated with it.";
|
||||
throw new IllegalStateException( message );
|
||||
}
|
||||
else
|
||||
|
@ -247,13 +247,14 @@ public class DefaultPluginManager
|
|||
}
|
||||
catch ( ArtifactEnabledContainerException e )
|
||||
{
|
||||
throw new PluginManagerException( "Error occurred in the artifact container attempting to download plugin " +
|
||||
groupId + ":" + artifactId, e );
|
||||
throw new PluginManagerException(
|
||||
"Error occurred in the artifact container attempting to download plugin "
|
||||
+ groupId + ":" + artifactId, e );
|
||||
}
|
||||
catch ( ArtifactResolutionException e )
|
||||
{
|
||||
if ( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() ) &&
|
||||
version.equals( e.getVersion() ) && "maven-plugin".equals( e.getType() ) )
|
||||
if ( groupId.equals( e.getGroupId() ) && artifactId.equals( e.getArtifactId() )
|
||||
&& version.equals( e.getVersion() ) && "maven-plugin".equals( e.getType() ) )
|
||||
{
|
||||
throw new PluginNotFoundException( groupId, artifactId, version, e );
|
||||
}
|
||||
|
@ -264,8 +265,8 @@ public class DefaultPluginManager
|
|||
}
|
||||
catch ( ComponentLookupException e )
|
||||
{
|
||||
throw new PluginManagerException(
|
||||
"Internal configuration error while retrieving " + groupId + ":" + artifactId, e );
|
||||
throw new PluginManagerException( "Internal configuration error while retrieving " + groupId + ":"
|
||||
+ artifactId, e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,10 +285,8 @@ public class DefaultPluginManager
|
|||
|
||||
MavenMetadataSource metadataSource = new MavenMetadataSource( artifactResolver, mavenProjectBuilder );
|
||||
|
||||
( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact, artifactResolver,
|
||||
session.getPluginRepositories(),
|
||||
session.getLocalRepository(), metadataSource,
|
||||
artifactFilter );
|
||||
( (ArtifactEnabledContainer) container ).addComponent( pluginArtifact, artifactResolver, session
|
||||
.getPluginRepositories(), session.getLocalRepository(), metadataSource, artifactFilter );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -334,8 +333,8 @@ public class DefaultPluginManager
|
|||
artifactResolver = (ArtifactResolver) container.lookup( ArtifactResolver.ROLE );
|
||||
mavenProjectBuilder = (MavenProjectBuilder) container.lookup( MavenProjectBuilder.ROLE );
|
||||
|
||||
resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder,
|
||||
mojoDescriptor.getRequiresDependencyResolution() );
|
||||
resolveTransitiveDependencies( session, artifactResolver, mavenProjectBuilder, mojoDescriptor
|
||||
.getRequiresDependencyResolution() );
|
||||
downloadDependencies( session, artifactResolver );
|
||||
}
|
||||
catch ( ComponentLookupException e )
|
||||
|
@ -381,37 +380,42 @@ public class DefaultPluginManager
|
|||
Xpp3Dom dom = session.getProject().getGoalConfiguration( PluginDescriptor.getPluginIdFromGoal( goalName ),
|
||||
goalId );
|
||||
|
||||
PlexusConfiguration configuration;
|
||||
PlexusConfiguration pomConfiguration;
|
||||
if ( dom == null )
|
||||
{
|
||||
configuration = new XmlPlexusConfiguration( "configuration" );
|
||||
pomConfiguration = new XmlPlexusConfiguration( "configuration" );
|
||||
}
|
||||
else
|
||||
{
|
||||
configuration = new XmlPlexusConfiguration( dom );
|
||||
pomConfiguration = new XmlPlexusConfiguration( dom );
|
||||
|
||||
// Validate against non-editable (@readonly) parameters, to make sure users aren't trying to
|
||||
// override in the POM.
|
||||
validatePomConfiguration( mojoDescriptor, pomConfiguration );
|
||||
}
|
||||
|
||||
ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, pathTranslator );
|
||||
|
||||
configuration = mergeConfiguration( configuration, mojoDescriptor.getConfiguration() );
|
||||
PlexusConfiguration mergedConfiguration = mergeConfiguration( pomConfiguration, mojoDescriptor
|
||||
.getConfiguration() );
|
||||
|
||||
try
|
||||
{
|
||||
if ( newMojoTechnique )
|
||||
{
|
||||
Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration,
|
||||
Map map = getPluginConfigurationFromExpressions( mojoDescriptor, mergedConfiguration,
|
||||
expressionEvaluator );
|
||||
|
||||
populatePluginFields( plugin, configuration, map, expressionEvaluator );
|
||||
populatePluginFields( plugin, pomConfiguration, map, expressionEvaluator );
|
||||
}
|
||||
else
|
||||
{
|
||||
getLogger().warn( "WARNING: The mojo " + mojoDescriptor.getId() + " is using the OLD API" );
|
||||
|
||||
Map map = getPluginConfigurationFromExpressions( mojoDescriptor, configuration,
|
||||
Map map = getPluginConfigurationFromExpressions( mojoDescriptor, mergedConfiguration,
|
||||
expressionEvaluator );
|
||||
|
||||
request = createPluginRequest( configuration, map );
|
||||
request = createPluginRequest( pomConfiguration, map );
|
||||
}
|
||||
}
|
||||
catch ( ExpressionEvaluationException e )
|
||||
|
@ -461,6 +465,47 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
private void validatePomConfiguration( MojoDescriptor goal, PlexusConfiguration pomConfiguration )
|
||||
throws PluginConfigurationException
|
||||
{
|
||||
List parameters = goal.getParameters();
|
||||
|
||||
for ( int i = 0; i < parameters.size(); i++ )
|
||||
{
|
||||
Parameter parameter = (Parameter) parameters.get( i );
|
||||
|
||||
boolean editable = parameter.isEditable();
|
||||
|
||||
// the key for the configuration map we're building.
|
||||
String key = parameter.getName();
|
||||
|
||||
// the key used to lookup the parameter in the config from the POM, etc.
|
||||
String lookupKey = parameter.getAlias();
|
||||
|
||||
if ( StringUtils.isEmpty( lookupKey ) )
|
||||
{
|
||||
lookupKey = key;
|
||||
}
|
||||
|
||||
// Make sure the parameter is either editable/configurable, or else is NOT specified in the POM
|
||||
if ( !editable
|
||||
&& ( pomConfiguration.getChild( lookupKey, false ) != null || pomConfiguration.getChild( key, false ) != null ) )
|
||||
{
|
||||
StringBuffer errorMessage = new StringBuffer().append( "ERROR: Cannot override read-only parameter: " )
|
||||
.append( key );
|
||||
|
||||
if ( !lookupKey.equals( key ) )
|
||||
{
|
||||
errorMessage.append( " (with alias: " ).append( lookupKey ).append( ")" );
|
||||
}
|
||||
|
||||
errorMessage.append( " in goal: " ).append( goal.getId() );
|
||||
|
||||
throw new PluginConfigurationException( errorMessage.toString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PlexusConfiguration mergeConfiguration( PlexusConfiguration dominant, PlexusConfiguration configuration )
|
||||
{
|
||||
// TODO: share with mergeXpp3Dom
|
||||
|
@ -551,7 +596,7 @@ public class DefaultPluginManager
|
|||
}
|
||||
|
||||
private void populatePluginFields( Plugin plugin, PlexusConfiguration configuration, Map map,
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
throws PluginConfigurationException
|
||||
{
|
||||
try
|
||||
|
@ -631,8 +676,8 @@ public class DefaultPluginManager
|
|||
/**
|
||||
* @deprecated [JC] in favor of what?
|
||||
*/
|
||||
private Map getPluginConfigurationFromExpressions( MojoDescriptor goal, PlexusConfiguration configuration,
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
private Map getPluginConfigurationFromExpressions( MojoDescriptor goal, PlexusConfiguration mergedConfiguration,
|
||||
ExpressionEvaluator expressionEvaluator )
|
||||
throws ExpressionEvaluationException, PluginConfigurationException
|
||||
{
|
||||
List parameters = goal.getParameters();
|
||||
|
@ -643,33 +688,55 @@ public class DefaultPluginManager
|
|||
{
|
||||
Parameter parameter = (Parameter) parameters.get( i );
|
||||
|
||||
boolean editable = parameter.isEditable();
|
||||
|
||||
// the key for the configuration map we're building.
|
||||
String key = parameter.getName();
|
||||
|
||||
|
||||
// the key used to lookup the parameter in the config from the POM, etc.
|
||||
String lookupKey = parameter.getAlias();
|
||||
|
||||
|
||||
if ( StringUtils.isEmpty( lookupKey ) )
|
||||
{
|
||||
lookupKey = key;
|
||||
}
|
||||
|
||||
String expression;
|
||||
if ( configuration.getChild( lookupKey, false ) == null )
|
||||
|
||||
boolean foundInConfiguration = false;
|
||||
|
||||
if ( mergedConfiguration.getChild( lookupKey, false ) != null )
|
||||
{
|
||||
expression = parameter.getExpression();
|
||||
expression = mergedConfiguration.getChild( lookupKey, false ).getValue( null );
|
||||
foundInConfiguration = true;
|
||||
}
|
||||
else if ( mergedConfiguration.getChild( key, false ) != null )
|
||||
{
|
||||
expression = mergedConfiguration.getChild( key, false ).getValue( null );
|
||||
foundInConfiguration = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = configuration.getChild( lookupKey, false ).getValue( null );
|
||||
expression = parameter.getExpression();
|
||||
}
|
||||
|
||||
if ( expression != null && parameter.getDeprecated() != null )
|
||||
if ( foundInConfiguration && expression != null && parameter.getDeprecated() != null )
|
||||
{
|
||||
PlexusConfiguration goalConfiguration = goal.getConfiguration();
|
||||
|
||||
if ( !expression.equals( goalConfiguration.getChild( lookupKey, false ).getValue( null ) )
|
||||
&& !expression.equals( goalConfiguration.getChild( key, false ).getValue( null ) ) )
|
||||
{
|
||||
if ( !expression.equals( goal.getConfiguration().getChild( lookupKey, false ).getValue( null ) ) )
|
||||
StringBuffer message = new StringBuffer().append( "DEPRECATED: " ).append( key );
|
||||
|
||||
if ( !lookupKey.equals( key ) )
|
||||
{
|
||||
getLogger().warn(
|
||||
"DEPRECATED: " + parameter.getName() + " is deprecated.\n\t" + parameter.getDeprecated() );
|
||||
message.append( " (aliased to " ).append( lookupKey ).append( ")" );
|
||||
}
|
||||
|
||||
message.append( " is deprecated.\n\t" ).append( parameter.getDeprecated() );
|
||||
|
||||
getLogger().warn( message.toString() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -696,7 +763,7 @@ public class DefaultPluginManager
|
|||
|
||||
if ( value == null && parameter.isRequired() )
|
||||
{
|
||||
throw new PluginConfigurationException( createPluginParameterRequiredMessage( goal, parameter ) );
|
||||
throw new PluginConfigurationException( createPluginParameterRequiredMessage( goal, parameter, expression ) );
|
||||
}
|
||||
|
||||
map.put( key, value );
|
||||
|
@ -704,7 +771,7 @@ public class DefaultPluginManager
|
|||
return map;
|
||||
}
|
||||
|
||||
public static String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter )
|
||||
public static String createPluginParameterRequiredMessage( MojoDescriptor mojo, Parameter parameter, String expression )
|
||||
{
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
@ -712,6 +779,7 @@ public class DefaultPluginManager
|
|||
message.append( "' parameter is required for the execution of the " );
|
||||
message.append( mojo.getId() );
|
||||
message.append( " mojo and cannot be null." );
|
||||
message.append( " The retrieval expression was: " ).append( expression );
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
@ -730,11 +798,20 @@ public class DefaultPluginManager
|
|||
{
|
||||
// TODO: configure this from bootstrap or scan lib
|
||||
// TODO: Note: maven-plugin just re-added until all plugins are switched over...
|
||||
artifactFilter = new ExclusionSetFilter( new String[]{"maven-core", "maven-artifact", "maven-model",
|
||||
"maven-settings", "maven-monitor", "maven-plugin-api",
|
||||
"maven-plugin-descriptor", "plexus-container-default",
|
||||
"maven-project", "plexus-container-artifact",
|
||||
"wagon-provider-api", "classworlds", "maven-plugin"} );
|
||||
artifactFilter = new ExclusionSetFilter( new String[] {
|
||||
"maven-core",
|
||||
"maven-artifact",
|
||||
"maven-model",
|
||||
"maven-settings",
|
||||
"maven-monitor",
|
||||
"maven-plugin-api",
|
||||
"maven-plugin-descriptor",
|
||||
"plexus-container-default",
|
||||
"maven-project",
|
||||
"plexus-container-artifact",
|
||||
"wagon-provider-api",
|
||||
"classworlds",
|
||||
"maven-plugin" } );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -742,7 +819,7 @@ public class DefaultPluginManager
|
|||
// ----------------------------------------------------------------------
|
||||
|
||||
private void resolveTransitiveDependencies( MavenSession context, ArtifactResolver artifactResolver,
|
||||
MavenProjectBuilder mavenProjectBuilder, String scope )
|
||||
MavenProjectBuilder mavenProjectBuilder, String scope )
|
||||
throws ArtifactResolutionException
|
||||
{
|
||||
MavenProject project = context.getProject();
|
||||
|
@ -753,10 +830,8 @@ public class DefaultPluginManager
|
|||
|
||||
boolean systemOnline = !context.getSettings().getActiveProfile().isOffline();
|
||||
|
||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(),
|
||||
context.getRemoteRepositories(),
|
||||
context.getLocalRepository(),
|
||||
sourceReader, filter );
|
||||
ArtifactResolutionResult result = artifactResolver.resolveTransitively( project.getArtifacts(), context
|
||||
.getRemoteRepositories(), context.getLocalRepository(), sourceReader, filter );
|
||||
|
||||
project.addArtifacts( result.getArtifacts().values(), artifactFactory );
|
||||
}
|
||||
|
@ -777,5 +852,4 @@ public class DefaultPluginManager
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,8 @@ public class Parameter
|
|||
private String type;
|
||||
|
||||
private boolean required;
|
||||
|
||||
private boolean editable = true;
|
||||
|
||||
private String validator;
|
||||
|
||||
|
@ -143,4 +145,14 @@ public class Parameter
|
|||
{
|
||||
this.alias = alias;
|
||||
}
|
||||
|
||||
public boolean isEditable()
|
||||
{
|
||||
return editable;
|
||||
}
|
||||
|
||||
public void setEditable( boolean editable )
|
||||
{
|
||||
this.editable = editable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,16 +142,27 @@ public class PluginDescriptorBuilder
|
|||
Parameter parameter = new Parameter();
|
||||
|
||||
parameter.setName( d.getChild( "name" ).getValue() );
|
||||
|
||||
parameter.setAlias( d.getChild( "alias" ).getValue() );
|
||||
|
||||
parameter.setType( d.getChild( "type" ).getValue() );
|
||||
|
||||
String s = d.getChild( "required" ).getValue();
|
||||
String required = d.getChild( "required" ).getValue();
|
||||
|
||||
if ( s != null )
|
||||
parameter.setRequired( "true".equals( required ) );
|
||||
|
||||
PlexusConfiguration editableConfig = d.getChild("editable");
|
||||
|
||||
// we need the null check for pre-build legacy plugins...
|
||||
if(editableConfig != null)
|
||||
{
|
||||
parameter.setRequired( s.equals( "true" ) ? true : false );
|
||||
String editable = d.getChild("editable").getValue();
|
||||
|
||||
System.out.println("Value of editable attribute for parameter: " + parameter.getName() + " is: " + editable);
|
||||
|
||||
parameter.setEditable( editable == null || "true".equals( editable ) );
|
||||
}
|
||||
|
||||
|
||||
parameter.setValidator( d.getChild( "validator" ).getValue() );
|
||||
|
||||
parameter.setDescription( d.getChild( "description" ).getValue() );
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
|||
import org.apache.maven.plugin.descriptor.Parameter;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.tools.plugin.util.PluginUtils;
|
||||
import org.codehaus.plexus.util.StringUtils;
|
||||
import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
|
||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||
|
||||
|
@ -178,50 +179,57 @@ public class PluginDescriptorGenerator
|
|||
{
|
||||
Parameter parameter = (Parameter) parameters.get( j );
|
||||
|
||||
w.startElement( "parameter" );
|
||||
|
||||
element( w, "name", parameter.getName() );
|
||||
String expression = parameter.getExpression();
|
||||
|
||||
if( parameter.getAlias() != null )
|
||||
if ( StringUtils.isNotEmpty( expression )
|
||||
&& ( expression.startsWith( "${component." ) || expression.startsWith( "#component." ) ) )
|
||||
{
|
||||
element( w, "alias", parameter.getAlias() );
|
||||
}
|
||||
// treat it as a component...a requirement, in other words.
|
||||
|
||||
element( w, "type", parameter.getType() );
|
||||
|
||||
if ( parameter.getDeprecated() != null )
|
||||
{
|
||||
element( w, "deprecated", parameter.getDeprecated() );
|
||||
}
|
||||
|
||||
element( w, "validator", parameter.getValidator() );
|
||||
|
||||
String value = null;
|
||||
if ( parameter.getExpression().startsWith( "#component." ) ||
|
||||
parameter.getExpression().startsWith( "${component." ) )
|
||||
{
|
||||
requirements.add( parameter );
|
||||
}
|
||||
else
|
||||
{
|
||||
// treat it as a normal parameter.
|
||||
|
||||
w.startElement( "parameter" );
|
||||
|
||||
element( w, "name", parameter.getName() );
|
||||
|
||||
if ( parameter.getAlias() != null )
|
||||
{
|
||||
element( w, "alias", parameter.getAlias() );
|
||||
}
|
||||
|
||||
element( w, "type", parameter.getType() );
|
||||
|
||||
if ( parameter.getDeprecated() != null )
|
||||
{
|
||||
element( w, "deprecated", parameter.getDeprecated() );
|
||||
}
|
||||
|
||||
// TODO: do we still need this?
|
||||
element( w, "validator", parameter.getValidator() );
|
||||
|
||||
element( w, "required", Boolean.toString( parameter.isRequired() ) );
|
||||
|
||||
value = parameter.getExpression();
|
||||
element( w, "editable", Boolean.toString( parameter.isEditable() ) );
|
||||
|
||||
element( w, "description", parameter.getDescription() );
|
||||
|
||||
if ( StringUtils.isEmpty( expression ) )
|
||||
{
|
||||
expression = parameter.getDefaultValue();
|
||||
}
|
||||
|
||||
if ( expression != null && expression.length() > 0 )
|
||||
{
|
||||
configuration.put( parameter, expression );
|
||||
}
|
||||
|
||||
w.endElement();
|
||||
}
|
||||
|
||||
element( w, "description", parameter.getDescription() );
|
||||
|
||||
if ( value == null || value.length() == 0 )
|
||||
{
|
||||
value = parameter.getDefaultValue();
|
||||
}
|
||||
|
||||
if ( value != null && value.length() > 0 )
|
||||
{
|
||||
configuration.put( parameter, value );
|
||||
}
|
||||
|
||||
w.endElement();
|
||||
}
|
||||
|
||||
w.endElement();
|
||||
|
|
|
@ -60,13 +60,15 @@ public class JavaMojoDescriptorExtractor
|
|||
public static final String MAVEN_PLUGIN_MODE = "maven.plugin.mode";
|
||||
|
||||
public static final String PARAMETER = "parameter";
|
||||
|
||||
|
||||
public static final String PARAMETER_EXPRESSION = "expression";
|
||||
|
||||
|
||||
public static final String REQUIRED = "required";
|
||||
|
||||
public static final String DEPRECATED = "deprecated";
|
||||
|
||||
public static final String READONLY = "readonly";
|
||||
|
||||
public static final String GOAL = "goal";
|
||||
|
||||
public static final String PHASE = "phase";
|
||||
|
@ -98,13 +100,6 @@ public class JavaMojoDescriptorExtractor
|
|||
throw new InvalidParameterException( "type", i );
|
||||
}
|
||||
|
||||
String expression = parameter.getExpression();
|
||||
|
||||
if ( expression == null )
|
||||
{
|
||||
throw new InvalidParameterException( "expression", i );
|
||||
}
|
||||
|
||||
// TODO: remove when backward compatibility is no longer an issue.
|
||||
String description = parameter.getDescription();
|
||||
|
||||
|
@ -261,10 +256,10 @@ public class JavaMojoDescriptorExtractor
|
|||
System.err.println( message );
|
||||
}
|
||||
|
||||
rawParams.put( tag.getNamedParameter("name"), tag );
|
||||
rawParams.put( tag.getNamedParameter( "name" ), tag );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extractFieldParameterTags( javaClass, rawParams );
|
||||
|
||||
Set parameters = new HashSet();
|
||||
|
@ -273,9 +268,9 @@ public class JavaMojoDescriptorExtractor
|
|||
{
|
||||
Map.Entry entry = (Entry) it.next();
|
||||
String paramName = (String) entry.getKey();
|
||||
|
||||
|
||||
Object val = entry.getValue();
|
||||
|
||||
|
||||
JavaField field = null;
|
||||
DocletTag parameter = null;
|
||||
|
||||
|
@ -301,26 +296,28 @@ public class JavaMojoDescriptorExtractor
|
|||
|
||||
pd.setType( parameter.getNamedParameter( "type" ) );
|
||||
|
||||
pd.setDefaultValue( parameter.getNamedParameter( "default" ) );
|
||||
|
||||
pd.setDescription( parameter.getNamedParameter( "description" ) );
|
||||
|
||||
pd.setRequired( parameter.getNamedParameter( REQUIRED ).equals( "true" ) ? true : false );
|
||||
|
||||
pd.setDeprecated( parameter.getNamedParameter( DEPRECATED ) );
|
||||
|
||||
pd.setRequired( parameter.getNamedParameter( "required" ).equals( "true" ) ? true : false );
|
||||
|
||||
pd.setDeprecated( parameter.getNamedParameter( "deprecated" ) );
|
||||
pd.setDefaultValue( parameter.getNamedParameter( "default" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
pd.setName( paramName );
|
||||
|
||||
pd.setType( field.getType().getValue() );
|
||||
|
||||
|
||||
pd.setDescription( field.getComment() );
|
||||
|
||||
pd.setRequired( field.getTagByName(REQUIRED) != null );
|
||||
|
||||
pd.setRequired( field.getTagByName( REQUIRED ) != null );
|
||||
|
||||
pd.setEditable( field.getTagByName( READONLY ) == null );
|
||||
|
||||
DocletTag deprecationTag = field.getTagByName( DEPRECATED );
|
||||
if( deprecationTag != null)
|
||||
if ( deprecationTag != null )
|
||||
{
|
||||
pd.setDeprecated( deprecationTag.getValue() );
|
||||
}
|
||||
|
|
|
@ -55,31 +55,51 @@ import java.util.jar.JarFile;
|
|||
* @goal assembly
|
||||
* @requiresDependencyResolution test
|
||||
* @description assemble an application bundle or distribution
|
||||
* @parameter name="basedir" type="String" required="true" validator="" expression="#basedir" description=""
|
||||
* @parameter name="outputDirectory" type="java.io.File" required="true" validator="" expression="#project.build.directory" description=""
|
||||
* @parameter name="workDirectory" type="java.io.File" required="true" validator="" expression="#project.build.directory/assembly/work" description="Directory to unpack JARs into if needed"
|
||||
* @parameter name="descriptor" type="java.io.File" required="false" validator="" expression="#maven.assembly.descriptor" description=""
|
||||
* @parameter name="finalName" type="String" required="true" validator="" expression="#project.build.finalName" description=""
|
||||
* @parameter name="descriptorId" type="String" required="false" validator="" expression="#maven.assembly.descriptorId" description=""
|
||||
* @parameter name="dependencies" type="java.util.Set" required="false" validator="" expression="#project.artifacts" description=""
|
||||
*/
|
||||
public class AssemblyMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
private static final String[] EMPTY_STRING_ARRAY = {};
|
||||
|
||||
/**
|
||||
* @parameter expression="${basedir}"
|
||||
* @required
|
||||
*/
|
||||
private String basedir;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
*/
|
||||
private File outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${maven.assembly.descriptor}"
|
||||
*/
|
||||
private File descriptor;
|
||||
|
||||
/**
|
||||
* @parameter expression="${maven.assembly.descriptorId}"
|
||||
*/
|
||||
private String descriptorId;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String finalName;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.artifacts}"
|
||||
*/
|
||||
private Set dependencies;
|
||||
|
||||
/**
|
||||
* Directory to unpack JARs into if needed
|
||||
*
|
||||
* @parameter expression="${project.build.directory}/assembly/work"
|
||||
* @required
|
||||
*/
|
||||
private File workDirectory;
|
||||
|
||||
public void execute()
|
||||
|
|
|
@ -26,18 +26,19 @@ import java.io.File;
|
|||
* @version $Id$
|
||||
* @goal clean
|
||||
* @description Goal which cleans the build
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.directory}"
|
||||
* description=""
|
||||
*/
|
||||
public class CleanPlugin
|
||||
extends AbstractPlugin
|
||||
{
|
||||
private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
|
||||
|
||||
/**
|
||||
* This is where compiled classes go.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
// TODO: not in the descriptor previously
|
||||
|
|
|
@ -14,21 +14,7 @@ package org.apache.maven.plugin;
|
|||
* the License.
|
||||
*/
|
||||
|
||||
import org.codehaus.plexus.compiler.util.scan.InclusionScanException;
|
||||
import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner;
|
||||
import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner;
|
||||
import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping;
|
||||
import org.codehaus.plexus.compiler.Compiler;
|
||||
import org.codehaus.plexus.compiler.CompilerConfiguration;
|
||||
import org.codehaus.plexus.compiler.CompilerError;
|
||||
import org.codehaus.plexus.compiler.javac.JavacCompiler;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||
|
@ -36,191 +22,47 @@ import java.util.Set;
|
|||
* @goal compile
|
||||
* @requiresDependencyResolution compile
|
||||
* @description Compiles application sources
|
||||
* @parameter name="compileSourceRoots" type="java.util.List" required="true" validator=""
|
||||
* expression="${project.compileSourceRoots}" description=""
|
||||
* @parameter name="outputDirectory" type="String" required="true" validator=""
|
||||
* expression="${project.build.outputDirectory}" description=""
|
||||
* @parameter name="classpathElements" type="List" required="true" validator=""
|
||||
* expression="${project.compileClasspathElements}" description=""
|
||||
* @parameter name="debug" type="boolean" required="false" validator=""
|
||||
* expression="${maven.compiler.debug}" description="Whether to include debugging
|
||||
* information in the compiled class files; the default value is false"
|
||||
* @todo change debug parameter type to Boolean
|
||||
* @parameter name="source" type="String" required="false" expression="${source}" validator=""
|
||||
* description="The -source argument for the Java compiler"
|
||||
* @parameter name="target" type="String" required="false" expression="${target}" validator=""
|
||||
* description="The -target argument for the Java compiler"
|
||||
* @parameter name="staleMillis" type="long" required="false" expression="${lastModGranularityMs}"
|
||||
* validator="" description="The granularity in milliseconds of the last modification
|
||||
* date for testing whether a source needs recompilation"
|
||||
* @todo change staleMillis parameter type to Long
|
||||
*/
|
||||
|
||||
public class CompilerMojo
|
||||
extends AbstractPlugin
|
||||
extends AbstractCompilerMojo
|
||||
{
|
||||
private Compiler compiler = new JavacCompiler();
|
||||
|
||||
// TODO: use boolean when supported
|
||||
private String debug = Boolean.TRUE.toString();
|
||||
|
||||
private List compileSourceRoots;
|
||||
|
||||
private List classpathElements;
|
||||
|
||||
private String outputDirectory;
|
||||
|
||||
private String source;
|
||||
|
||||
private String target;
|
||||
|
||||
// TODO: Use long when supported
|
||||
private String staleMillis = "0";
|
||||
|
||||
public void execute()
|
||||
throws PluginExecutionException
|
||||
{
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
compileSourceRoots = removeEmptyCompileSourceRoots( compileSourceRoots );
|
||||
if ( compileSourceRoots.isEmpty() )
|
||||
{
|
||||
getLog().info( "No sources to compile" );
|
||||
return;
|
||||
}
|
||||
|
||||
CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
|
||||
|
||||
compilerConfiguration.setOutputLocation( outputDirectory );
|
||||
compilerConfiguration.setClasspathEntries( classpathElements );
|
||||
compilerConfiguration.setSourceLocations( compileSourceRoots );
|
||||
|
||||
// TODO: have an option to always compile (without need to clean)
|
||||
Set staleSources = computeStaleSources();
|
||||
|
||||
if ( staleSources.isEmpty() )
|
||||
{
|
||||
getLog().info( "Nothing to compile - all classes are up to date" );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
compilerConfiguration.setSourceFiles( staleSources );
|
||||
}
|
||||
|
||||
if ( source != null )
|
||||
{
|
||||
compilerConfiguration.addCompilerOption( "-source", source );
|
||||
}
|
||||
|
||||
if ( target != null )
|
||||
{
|
||||
compilerConfiguration.addCompilerOption( "-target", target );
|
||||
}
|
||||
|
||||
if ( debug != null && "true".equals( debug ) )
|
||||
{
|
||||
compilerConfiguration.setDebug( true );
|
||||
}
|
||||
|
||||
List messages = null;
|
||||
try
|
||||
{
|
||||
messages = compiler.compile( compilerConfiguration );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
// TODO: don't catch Exception
|
||||
throw new PluginExecutionException( "Fatal error compiling", e );
|
||||
}
|
||||
|
||||
boolean compilationError = false;
|
||||
|
||||
for ( Iterator i = messages.iterator(); i.hasNext(); )
|
||||
{
|
||||
CompilerError message = (CompilerError) i.next();
|
||||
|
||||
if ( message.isError() )
|
||||
{
|
||||
compilationError = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( compilationError )
|
||||
{
|
||||
throw new CompilationFailureException( messages );
|
||||
}
|
||||
}
|
||||
|
||||
private Set computeStaleSources()
|
||||
throws PluginExecutionException
|
||||
{
|
||||
long staleTime = 0;
|
||||
|
||||
if ( staleMillis != null && staleMillis.length() > 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
staleTime = Long.parseLong( staleMillis );
|
||||
}
|
||||
catch ( NumberFormatException e )
|
||||
{
|
||||
throw new PluginExecutionException( "Invalid staleMillis plugin parameter value: \'" + staleMillis +
|
||||
"\'", e );
|
||||
}
|
||||
|
||||
}
|
||||
SuffixMapping mapping = new SuffixMapping( ".java", ".class" );
|
||||
|
||||
SourceInclusionScanner scanner = new StaleSourceScanner( staleTime );
|
||||
|
||||
scanner.addSourceMapping( mapping );
|
||||
|
||||
File outDir = new File( outputDirectory );
|
||||
|
||||
Set staleSources = new HashSet();
|
||||
|
||||
for ( Iterator it = compileSourceRoots.iterator(); it.hasNext(); )
|
||||
{
|
||||
String sourceRoot = (String) it.next();
|
||||
|
||||
File rootFile = new File( sourceRoot );
|
||||
|
||||
try
|
||||
{
|
||||
staleSources.addAll( scanner.getIncludedSources( rootFile, outDir ) );
|
||||
}
|
||||
catch ( InclusionScanException e )
|
||||
{
|
||||
throw new PluginExecutionException( "Error scanning source root: \'" + sourceRoot +
|
||||
"\' for stale files to recompile.", e );
|
||||
}
|
||||
}
|
||||
|
||||
return staleSources;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo also in ant plugin. This should be resolved at some point so that it does not need to
|
||||
* be calculated continuously - or should the plugins accept empty source roots as is?
|
||||
* @parameter expression="${project.compileSourceRoots}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private static List removeEmptyCompileSourceRoots( List compileSourceRootsList )
|
||||
private List compileSourceRoots;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.compileClasspathElements}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List classpathElements;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.outputDirectory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
protected List getCompileSourceRoots()
|
||||
{
|
||||
List newCompileSourceRootsList = new ArrayList();
|
||||
if ( compileSourceRootsList != null )
|
||||
{
|
||||
// copy as I may be modifying it
|
||||
for ( Iterator i = compileSourceRootsList.iterator(); i.hasNext(); )
|
||||
{
|
||||
String srcDir = (String) i.next();
|
||||
if ( !newCompileSourceRootsList.contains( srcDir ) && new File( srcDir ).exists() )
|
||||
{
|
||||
newCompileSourceRootsList.add( srcDir );
|
||||
}
|
||||
}
|
||||
}
|
||||
return newCompileSourceRootsList;
|
||||
return compileSourceRoots;
|
||||
}
|
||||
|
||||
protected List getClasspathElements()
|
||||
{
|
||||
return classpathElements;
|
||||
}
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package org.apache.maven.plugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -22,32 +24,44 @@ package org.apache.maven.plugin;
|
|||
* @goal testCompile
|
||||
* @description Compiles test sources
|
||||
* @requiresDependencyResolution test
|
||||
* @parameter name="compileSourceRoots"
|
||||
* type="java.util.List"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.testCompileSourceRoots}"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.testOutputDirectory}"
|
||||
* description=""
|
||||
* @parameter name="classpathElements"
|
||||
* type="List"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.testClasspathElements}"
|
||||
* description=""
|
||||
* @parameter name="debug"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression="${maven.compiler.debug}"
|
||||
* description="Whether to include debugging information in the compiled class files; the default value is false"
|
||||
*/
|
||||
public class TestCompilerMojo
|
||||
extends CompilerMojo
|
||||
extends AbstractCompilerMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.testCompileSourceRoots}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List compileSourceRoots;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.testClasspathElements}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List classpathElements;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.testOutputDirectory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
protected List getCompileSourceRoots()
|
||||
{
|
||||
return compileSourceRoots;
|
||||
}
|
||||
|
||||
protected List getClasspathElements()
|
||||
{
|
||||
return classpathElements;
|
||||
}
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,50 +24,88 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
|
||||
* @author <a href="mailto:jdcasey@apache.org">John Casey (refactoring only)</a>
|
||||
* @version $Id$
|
||||
* @goal deploy
|
||||
* @description deploys an artifact to remote repository
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project}"
|
||||
* description=""
|
||||
* @parameter name="deployer"
|
||||
* type="org.apache.maven.artifact.deployer.ArtifactDeployer"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${component.org.apache.maven.artifact.deployer.ArtifactDeployer}"
|
||||
* description=""
|
||||
* @parameter name="deploymentRepository"
|
||||
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.distributionManagementArtifactRepository}"
|
||||
* description=""
|
||||
* @parameter name="localRepository"
|
||||
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${localRepository}"
|
||||
* description=""
|
||||
*/
|
||||
public class DeployMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.groupId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.artifactId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.version}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.packaging}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String packaging;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.file.parentFile}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private File parentDir;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String buildDirectory;
|
||||
|
||||
/**
|
||||
* @parameter alias="archiveName" expression="${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String finalName;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.artifact.deployer.ArtifactDeployer}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactDeployer deployer;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.distributionManagementArtifactRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository deploymentRepository;
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
public void execute()
|
||||
|
@ -75,16 +113,15 @@ public class DeployMojo
|
|||
{
|
||||
if ( deploymentRepository == null )
|
||||
{
|
||||
String msg = "Deployment failed: repository element was not specified in the pom inside" +
|
||||
" distributionManagement element";
|
||||
String msg = "Deployment failed: repository element was not specified in the pom inside"
|
||||
+ " distributionManagement element";
|
||||
throw new PluginExecutionException( msg );
|
||||
}
|
||||
|
||||
// Deploy the POM
|
||||
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
||||
project.getPackaging() );
|
||||
boolean isPomArtifact = "pom".equals( project.getPackaging() );
|
||||
File pom = new File( project.getFile().getParentFile(), "pom.xml" );
|
||||
Artifact artifact = new DefaultArtifact( groupId, artifactId, version, packaging );
|
||||
boolean isPomArtifact = "pom".equals( packaging );
|
||||
File pom = new File( parentDir, "pom.xml" );
|
||||
if ( !isPomArtifact )
|
||||
{
|
||||
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom );
|
||||
|
@ -95,8 +132,7 @@ public class DeployMojo
|
|||
{
|
||||
if ( !isPomArtifact )
|
||||
{
|
||||
deployer.deploy( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact,
|
||||
deploymentRepository, localRepository );
|
||||
deployer.deploy( buildDirectory, finalName, artifact, deploymentRepository, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,43 +30,6 @@ import java.io.File;
|
|||
* @goal ejb
|
||||
* @phase package
|
||||
* @description build an ejb
|
||||
* @parameter name="jarName"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.finalName"
|
||||
* description=""
|
||||
* @parameter name="archive"
|
||||
* type=""
|
||||
* required="false"
|
||||
* expression=""
|
||||
* validator=""
|
||||
* description=""
|
||||
* @parameter name="generateClient"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression=""
|
||||
* default="false"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.outputDirectory"
|
||||
* description=""
|
||||
* @parameter name="basedir"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description="current MavenProject instance"
|
||||
*/
|
||||
public class EjbMojo
|
||||
extends AbstractPlugin
|
||||
|
@ -79,20 +42,42 @@ public class EjbMojo
|
|||
|
||||
/**
|
||||
* @todo File instead
|
||||
*
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String basedir;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.outputDirectory}"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String jarName;
|
||||
|
||||
/**
|
||||
* @todo boolean instead
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
private String generateClient;
|
||||
private String generateClient = Boolean.FALSE.toString();
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,17 +41,16 @@ import java.util.Iterator;
|
|||
* @executePhase generate-sources
|
||||
* @requiresDependencyResolution test
|
||||
* @description Goal for generating IDEA files from a POM
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description=""
|
||||
* @todo use dom4j or something. Xpp3Dom can't cope properly with entities and so on
|
||||
*/
|
||||
public class IdeaMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
public void execute()
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.maven.artifact.metadata.ArtifactMetadata;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.project.artifact.ProjectArtifactMetadata;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -34,42 +33,80 @@ import java.io.File;
|
|||
* @version $Id$
|
||||
* @goal install
|
||||
* @description installs project's main artifact in local repository
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project}"
|
||||
* description=""
|
||||
* @parameter name="installer"
|
||||
* type="org.apache.maven.artifact.installer.ArtifactInstaller"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${component.org.apache.maven.artifact.installer.ArtifactInstaller}"
|
||||
* description=""
|
||||
* @parameter name="localRepository"
|
||||
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${localRepository}"
|
||||
* description=""
|
||||
*/
|
||||
public class InstallMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.groupId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String groupId;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.artifactId}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String artifactId;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.version}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String version;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.packaging}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String packaging;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.file.parentFile}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private File parentDir;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String buildDirectory;
|
||||
|
||||
/**
|
||||
* @parameter alias="archiveName" expression="${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String finalName;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.artifact.installer.ArtifactInstaller}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactInstaller installer;
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
public void execute()
|
||||
throws PluginExecutionException
|
||||
{
|
||||
Artifact artifact = new DefaultArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion(),
|
||||
project.getPackaging() );
|
||||
Artifact artifact = new DefaultArtifact( groupId, artifactId, version, packaging );
|
||||
|
||||
boolean isPomArtifact = "pom".equals( project.getPackaging() );
|
||||
File pom = new File( project.getFile().getParentFile(), "pom.xml" );
|
||||
boolean isPomArtifact = "pom".equals( packaging );
|
||||
File pom = new File( parentDir, "pom.xml" );
|
||||
if ( !isPomArtifact )
|
||||
{
|
||||
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom );
|
||||
|
@ -81,8 +118,7 @@ public class InstallMojo
|
|||
if ( !isPomArtifact )
|
||||
{
|
||||
// TODO: would be something nice to get back from the project to get the full filename (the OGNL feedback thing)
|
||||
installer.install( project.getBuild().getDirectory(), project.getBuild().getFinalName(), artifact,
|
||||
localRepository );
|
||||
installer.install( buildDirectory, finalName, artifact, localRepository );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,55 +30,47 @@ import java.io.File;
|
|||
* @goal jar
|
||||
* @phase package
|
||||
* @description build a jar
|
||||
* @parameter name="jarName"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.finalName}"
|
||||
* description=""
|
||||
* @parameter name="archive"
|
||||
* type=""
|
||||
* required="false"
|
||||
* expression=""
|
||||
* validator=""
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.outputDirectory}"
|
||||
* description=""
|
||||
* @parameter name="basedir"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.directory}"
|
||||
* description=""
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project}"
|
||||
* description="current MavenProject instance"
|
||||
*/
|
||||
public class JarMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @todo File
|
||||
*/
|
||||
private String basedir;
|
||||
|
||||
private String jarName;
|
||||
|
||||
private String outputDirectory;
|
||||
|
||||
|
||||
private static final String[] DEFAULT_EXCLUDES = new String[]{"**/package.html"};
|
||||
|
||||
private static final String[] DEFAULT_INCLUDES = new String[]{"**/**"};
|
||||
|
||||
/**
|
||||
* @todo Change type to File
|
||||
*
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String basedir;
|
||||
|
||||
/**
|
||||
* @parameter alias="jarName" expression="${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String finalName;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.outputDirectory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
|
||||
|
||||
/**
|
||||
|
@ -87,7 +79,7 @@ public class JarMojo
|
|||
public void execute()
|
||||
throws PluginExecutionException
|
||||
{
|
||||
File jarFile = new File( basedir, jarName + ".jar" );
|
||||
File jarFile = new File( basedir, finalName + ".jar" );
|
||||
|
||||
MavenArchiver archiver = new MavenArchiver();
|
||||
|
||||
|
|
|
@ -30,11 +30,19 @@ import java.util.Set;
|
|||
public abstract class AbstractGeneratorMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
protected String outputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
*/
|
||||
protected MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.tools.plugin.scanner.MojoScanner}"
|
||||
* @required
|
||||
*/
|
||||
protected MojoScanner mojoScanner;
|
||||
|
||||
protected abstract String getOutputDirectory();
|
||||
|
||||
protected abstract void generate( String outputDirectory, Set mavenMojoDescriptors, MavenProject project )
|
||||
throws Exception;
|
||||
|
@ -46,7 +54,7 @@ public abstract class AbstractGeneratorMojo
|
|||
{
|
||||
Set mavenMojoDescriptors = mojoScanner.execute( project );
|
||||
|
||||
generate( outputDirectory, mavenMojoDescriptors, project );
|
||||
generate( getOutputDirectory(), mavenMojoDescriptors, project );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
|
|
@ -26,28 +26,21 @@ import java.util.Set;
|
|||
* @version $Id$
|
||||
* @goal bean
|
||||
* @description Goal for generating a plugin descriptor.
|
||||
* @parameter name="mojoScanner"
|
||||
* type="org.apache.maven.tools.plugin.scanner.MojoScanner"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#component.org.apache.maven.tools.plugin.scanner.MojoScanner"
|
||||
* description="Scanner used to discover mojo descriptors from this project"
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory/generated-sources"
|
||||
* description=""
|
||||
*/
|
||||
public class BeanGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}/generated-sources"
|
||||
* @required
|
||||
*/
|
||||
protected String outputDirectory;
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
protected void generate( String outputDirectory, Set mavenMojoDescriptors, MavenProject project )
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -31,28 +31,21 @@ import java.util.Set;
|
|||
* @goal descriptor
|
||||
* @phase process-classes
|
||||
* @description Goal for generating a plugin descriptor.
|
||||
* @parameter name="mojoScanner"
|
||||
* type="org.apache.maven.tools.plugin.scanner.MojoScanner"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${component.org.apache.maven.tools.plugin.scanner.MojoScanner}"
|
||||
* description="Scanner used to discover mojo descriptors from this project"
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project}"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.build.outputDirectory}/META-INF/maven"
|
||||
* description=""
|
||||
*/
|
||||
public class DescriptorGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.outputDirectory}/META-INF/maven"
|
||||
* @required
|
||||
*/
|
||||
protected String outputDirectory;
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
protected void generate( String outputDirectory, Set mavenMojoDescriptors, MavenProject project )
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -26,28 +26,21 @@ import java.util.Set;
|
|||
* @version $Id$
|
||||
* @goal jelly
|
||||
* @description Goal for generating a plugin descriptor.
|
||||
* @parameter name="mojoScanner"
|
||||
* type="org.apache.maven.tools.plugin.scanner.MojoScanner"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#component.org.apache.maven.tools.plugin.scanner.MojoScanner"
|
||||
* description="Scanner used to discover mojo descriptors from this project"
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory/generated-sources"
|
||||
* description=""
|
||||
*/
|
||||
public class JellyGeneratorMojo
|
||||
extends AbstractGeneratorMojo
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}/generated-sources"
|
||||
* @required
|
||||
*/
|
||||
protected String outputDirectory;
|
||||
|
||||
protected String getOutputDirectory()
|
||||
{
|
||||
return outputDirectory;
|
||||
}
|
||||
|
||||
protected void generate( String outputDirectory, Set mavenMojoDescriptors, MavenProject project )
|
||||
throws Exception
|
||||
{
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package org.apache.maven.doxia;
|
||||
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.plugin.Plugin;
|
||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
@ -17,80 +14,66 @@ import java.util.List;
|
|||
/**
|
||||
* @goal site
|
||||
* @description Doxia plugin
|
||||
* @parameter name="siteDirectory"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${basedir}/src/site"
|
||||
* description=""
|
||||
* @parameter name="generatedSiteDirectory"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${project.build.directory}/site-generated"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${project.build.directory}/site"
|
||||
* description=""
|
||||
* @parameter name="flavour"
|
||||
* type="String"
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="maven"
|
||||
* description=""
|
||||
* @parameter name="project"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${project}"
|
||||
* description=""
|
||||
* @parameter name="localRepository"
|
||||
* type="org.apache.maven.artifact.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#localRepository"
|
||||
* description=""
|
||||
* @parameter name="remoteRepositories"
|
||||
* type="java.util.List"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.remoteArtifactRepositories"
|
||||
* description=""
|
||||
* @parameter name="siteRenderer"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
|
||||
* description=""
|
||||
* @parameter name="reportManager"
|
||||
* type=""
|
||||
* required=""
|
||||
* validator=""
|
||||
* expression="${component.org.apache.maven.reporting.manager.MavenReportManager}"
|
||||
* description=""
|
||||
*/
|
||||
public class DoxiaMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @parameter expression="${basedir}/src/site"
|
||||
* @required
|
||||
*/
|
||||
private String siteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter alias="workingDirectory" expression="${project.build.directory}/site-generated"
|
||||
* @required
|
||||
*/
|
||||
private String generatedSiteDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expressoin="${project.build.directory}/site"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
private String flavour;
|
||||
/**
|
||||
* @parameter alias="flavor"
|
||||
*/
|
||||
private String flavour = "maven";
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.codehaus.doxia.site.renderer.SiteRenderer}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private SiteRenderer siteRenderer;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @parameter expression="${component.org.apache.maven.reporting.manager.MavenReportManager}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenReportManager reportManager;
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.remoteArtifactRepositories}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List remoteRepositories;
|
||||
|
||||
public void execute()
|
||||
|
|
|
@ -4,17 +4,14 @@
|
|||
package org.apache.maven.doxia;
|
||||
|
||||
import org.apache.maven.model.DistributionManagement;
|
||||
import org.apache.maven.plugin.Plugin;
|
||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.wagon.ConnectionException;
|
||||
import org.apache.maven.wagon.WagonUtils;
|
||||
import org.apache.maven.wagon.observers.Debug;
|
||||
import org.apache.maven.wagon.providers.ssh.SshCommandExecutor;
|
||||
import org.apache.maven.wagon.providers.ssh.ScpWagon;
|
||||
import org.apache.maven.wagon.providers.ssh.SshCommandExecutor;
|
||||
import org.apache.maven.wagon.repository.Repository;
|
||||
import org.codehaus.plexus.util.FileUtils;
|
||||
|
||||
|
@ -36,40 +33,32 @@ import java.util.zip.ZipOutputStream;
|
|||
* then archive is transfred to remote host, nextly it is un-archived.
|
||||
* This method of deployment should normally be much faster
|
||||
* then making file by file copy.
|
||||
* @parameter name="inputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory/site"
|
||||
* description=""
|
||||
* @parameter name="workingDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
* @parameter name="unzipCommand"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="unzip -o"
|
||||
* description=""
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description=""
|
||||
*/
|
||||
public class ScpSiteDeployMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
/**
|
||||
* @parameter alias="siteDirectory" expression="${project.build.directory}/site"
|
||||
* @required
|
||||
*/
|
||||
private String inputDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
*/
|
||||
private String workingDirectory;
|
||||
|
||||
private String unzipCommand;
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private String unzipCommand = "unzip -o";
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
public void execute()
|
||||
|
|
|
@ -34,82 +34,67 @@ import java.util.StringTokenizer;
|
|||
* @version $Id$
|
||||
* @goal test
|
||||
* @description Run tests using surefire
|
||||
* @parameter name="basedir"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator="validator"
|
||||
* expression="${basedir}"
|
||||
* description=""
|
||||
* @parameter name="classesDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator="validator"
|
||||
* expression="${project.build.outputDirectory}"
|
||||
* description=""
|
||||
* @parameter name="testClassesDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator="validator"
|
||||
* expression="${project.build.testOutputDirectory}"
|
||||
* description=""
|
||||
* @parameter name="includes"
|
||||
* type="java.util.List"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* description=""
|
||||
* expression=""
|
||||
* @parameter name="excludes"
|
||||
* type="java.util.List"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* description=""
|
||||
* expression=""
|
||||
* @parameter name="classpathElements"
|
||||
* type="java.util.List"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${project.testClasspathElements}"
|
||||
* description=""
|
||||
* @parameter name="reportsDirectory"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression="${project.build.directory/surefire-reports}"
|
||||
* description="Base directory where all reports are written to."
|
||||
* @parameter name="test"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression="${test}"
|
||||
* description="Specify this parameter if you want to use the test regex notation to select tests to run."
|
||||
* @parameter name="localRepository"
|
||||
* type="org.apache.maven.artifact.repository.ArtifactRepository"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="${localRepository}"
|
||||
* description=""
|
||||
* @todo make version of junit and surefire configurable
|
||||
* @todo make report to be produced configurable
|
||||
*/
|
||||
public class SurefirePlugin
|
||||
extends AbstractPlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* @parameter expression="${basedir}"
|
||||
* @required
|
||||
*/
|
||||
private String basedir;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.outputDirectory}"
|
||||
* @required
|
||||
*/
|
||||
private String classesDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.testOutputDirectory}"
|
||||
* @required
|
||||
*/
|
||||
private String testClassesDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.testClasspathElements}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private List classpathElements;
|
||||
|
||||
/**
|
||||
* Base directory where all reports are written to.
|
||||
*
|
||||
* @parameter expression="${project.build.directory}/surefire-reports"
|
||||
*/
|
||||
private String reportsDirectory;
|
||||
|
||||
/**
|
||||
* Specify this parameter if you want to use the test regex notation to select tests to run.
|
||||
*
|
||||
* @parameter
|
||||
*/
|
||||
private String test;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private List includes;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private List excludes;
|
||||
|
||||
/**
|
||||
* @parameter expression="${localRepository}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private ArtifactRepository localRepository;
|
||||
|
||||
public void execute()
|
||||
|
|
|
@ -41,110 +41,80 @@ import java.util.Set;
|
|||
* @goal war
|
||||
* @phase package
|
||||
* @description build a war/webapp
|
||||
* @parameter name="warName"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.finalName"
|
||||
* description=""
|
||||
* deprecated="Please use the finalName element of build instead"
|
||||
* @parameter name="archive"
|
||||
* type=""
|
||||
* required="false"
|
||||
* expression=""
|
||||
* validator=""
|
||||
* description=""
|
||||
* @parameter name="warSourceDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#basedir/src/main/webapp"
|
||||
* description=""
|
||||
* @parameter name="warSourceIncludes"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression=""
|
||||
* default="**"
|
||||
* description=""
|
||||
* @parameter name="warSourceExcludes"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression=""
|
||||
* description=""
|
||||
* @parameter name="webXml"
|
||||
* type="String"
|
||||
* required="false"
|
||||
* validator=""
|
||||
* expression="#maven.war.webxml"
|
||||
* description=""
|
||||
* @parameter name="webappDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory/#project.build.finalName"
|
||||
* description=""
|
||||
* @parameter name="mode"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression=""
|
||||
* default="war"
|
||||
* description=""
|
||||
* @parameter name="classesDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.outputDirectory"
|
||||
* description=""
|
||||
* @parameter name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
* @parameter name="project"
|
||||
* type="org.apache.maven.project.MavenProject"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project"
|
||||
* description="current MavenProject instance"
|
||||
*/
|
||||
public class WarMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
public static final String WEB_INF = "WEB-INF";
|
||||
|
||||
private String mode;
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private String mode = "war";
|
||||
|
||||
/**
|
||||
* @parameter expression="${project}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private MavenProject project;
|
||||
|
||||
/**
|
||||
* @todo File
|
||||
* @todo Convert to File
|
||||
*
|
||||
* @parameter expression="${project.build.outputDirectory}"
|
||||
* @required
|
||||
* @readonly
|
||||
*/
|
||||
private String classesDirectory;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.directory}"
|
||||
* @required
|
||||
*/
|
||||
private String outputDirectory;
|
||||
|
||||
/**
|
||||
* @todo File
|
||||
* @todo Convert to File
|
||||
*
|
||||
* @parameter expression="${project.build.directory}/${project.build.finalName}"
|
||||
* @required
|
||||
*/
|
||||
private String webappDirectory;
|
||||
|
||||
/**
|
||||
* @todo File
|
||||
* @todo Convert to File
|
||||
*
|
||||
* @parameter expression="${basedir}/src/main/webapp"
|
||||
* @required
|
||||
*/
|
||||
private String warSourceDirectory;
|
||||
|
||||
private String warSourceIncludes;
|
||||
/**
|
||||
* @parameter alias="includes"
|
||||
*/
|
||||
private String warSourceIncludes = "**";
|
||||
|
||||
/**
|
||||
* @parameter alias="excludes"
|
||||
*/
|
||||
private String warSourceExcludes;
|
||||
|
||||
/**
|
||||
* @parameter expression="${maven.war.webxml}"
|
||||
*/
|
||||
private String webXml;
|
||||
|
||||
/**
|
||||
* @parameter expression="${project.build.finalName}"
|
||||
* @required
|
||||
* @deprecated "Please use the finalName element of build instead"
|
||||
*/
|
||||
private String warName;
|
||||
|
||||
/**
|
||||
* @parameter
|
||||
*/
|
||||
private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
|
||||
|
||||
private static final String[] EMPTY_STRING_ARRAY = {};
|
||||
|
|
Loading…
Reference in New Issue