mirror of https://github.com/apache/maven.git
Working on MNG-250...
Resolving MNG-488 o Brought the metadata tags for marmalade mojos up to snuff with the java-mojo annotations o Added @aggregator annotation ( <aggregator>true</aggregator> in marmalade) for mojos o Added support for aggregator flag throughout plugin-descriptor, generator, and builder. More commits to follow... git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226329 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
86c55a3bd1
commit
9d6ba0d633
|
@ -62,6 +62,8 @@ public class MojoDescriptor
|
||||||
|
|
||||||
private String deprecated;
|
private String deprecated;
|
||||||
|
|
||||||
|
private boolean aggregator = false;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -389,4 +391,14 @@ public class MojoDescriptor
|
||||||
{
|
{
|
||||||
this.executeLifecycle = executeLifecycle;
|
this.executeLifecycle = executeLifecycle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAggregator( boolean aggregator )
|
||||||
|
{
|
||||||
|
this.aggregator = aggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAggregator()
|
||||||
|
{
|
||||||
|
return aggregator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,13 @@ public class PluginDescriptorBuilder
|
||||||
mojo.setProjectRequired( Boolean.valueOf( requiresProject ).booleanValue() );
|
mojo.setProjectRequired( Boolean.valueOf( requiresProject ).booleanValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String aggregator = c.getChild( "aggregator" ).getValue();
|
||||||
|
|
||||||
|
if ( aggregator != null )
|
||||||
|
{
|
||||||
|
mojo.setAggregator( Boolean.valueOf( aggregator ).booleanValue() );
|
||||||
|
}
|
||||||
|
|
||||||
String requiresOnline = c.getChild( "requiresOnline" ).getValue();
|
String requiresOnline = c.getChild( "requiresOnline" ).getValue();
|
||||||
|
|
||||||
if ( requiresOnline != null )
|
if ( requiresOnline != null )
|
||||||
|
|
|
@ -132,6 +132,12 @@ public class PluginDescriptorGenerator
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
element( w, "aggregator", "" + mojoDescriptor.isAggregator() );
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() );
|
element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() );
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class JavaMojoDescriptorExtractor
|
||||||
implements MojoDescriptorExtractor
|
implements MojoDescriptorExtractor
|
||||||
{
|
{
|
||||||
public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy";
|
public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy";
|
||||||
|
|
||||||
public static final String CONFIGURATOR = "configurator";
|
public static final String CONFIGURATOR = "configurator";
|
||||||
|
|
||||||
public static final String PARAMETER = "parameter";
|
public static final String PARAMETER = "parameter";
|
||||||
|
@ -77,6 +78,8 @@ public class JavaMojoDescriptorExtractor
|
||||||
|
|
||||||
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
|
public static final String GOAL_REQUIRES_PROJECT = "requiresProject";
|
||||||
|
|
||||||
|
public static final String GOAL_IS_AGGREGATOR = "aggregator";
|
||||||
|
|
||||||
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
|
public static final String GOAL_REQUIRES_ONLINE = "requiresOnline";
|
||||||
|
|
||||||
public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault";
|
public static final String GOAL_INHERIT_BY_DEFAULT = "inheritByDefault";
|
||||||
|
@ -236,6 +239,17 @@ public class JavaMojoDescriptorExtractor
|
||||||
mojoDescriptor.setProjectRequired( true );
|
mojoDescriptor.setProjectRequired( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Aggregator flag
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
DocletTag aggregator = findInClassHierarchy( javaClass, GOAL_IS_AGGREGATOR );
|
||||||
|
|
||||||
|
if ( aggregator != null )
|
||||||
|
{
|
||||||
|
mojoDescriptor.setAggregator( true );
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Online flag
|
// Online flag
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.apache.maven.script.marmalade.tags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jdcasey Created on Feb 8, 2005
|
||||||
|
*/
|
||||||
|
public class AggregatorTag
|
||||||
|
extends AbstractBooleanValuedBodyTag
|
||||||
|
{
|
||||||
|
|
||||||
|
protected void setValue( Boolean value ) throws MarmaladeExecutionException
|
||||||
|
{
|
||||||
|
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||||
|
metadataTag.setAggregator( value.booleanValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.apache.maven.script.marmalade.tags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jdcasey Created on Feb 8, 2005
|
||||||
|
*/
|
||||||
|
public class ExecuteLifecycleTag
|
||||||
|
extends AbstractStringValuedBodyTag
|
||||||
|
{
|
||||||
|
|
||||||
|
protected void setValue( String value ) throws MarmaladeExecutionException
|
||||||
|
{
|
||||||
|
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||||
|
metadataTag.setExecuteLifecycle( value );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -21,14 +21,14 @@ import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
/**
|
/**
|
||||||
* @author jdcasey Created on Feb 8, 2005
|
* @author jdcasey Created on Feb 8, 2005
|
||||||
*/
|
*/
|
||||||
public class LifecyclePhaseTag
|
public class ExecutePhaseTag
|
||||||
extends AbstractStringValuedBodyTag
|
extends AbstractStringValuedBodyTag
|
||||||
{
|
{
|
||||||
|
|
||||||
protected void setValue( String value ) throws MarmaladeExecutionException
|
protected void setValue( String value ) throws MarmaladeExecutionException
|
||||||
{
|
{
|
||||||
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||||
metadataTag.setLifecyclePhase( value );
|
metadataTag.setExecutePhase( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -17,7 +17,6 @@ package org.apache.maven.script.marmalade.tags;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.codehaus.marmalade.model.AbstractMarmaladeTag;
|
import org.codehaus.marmalade.model.AbstractMarmaladeTag;
|
||||||
import org.codehaus.marmalade.model.MarmaladeTag;
|
|
||||||
import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
|
||||||
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
|
|
||||||
|
@ -37,7 +36,7 @@ public class ExecuteTag
|
||||||
{
|
{
|
||||||
for ( Iterator it = children().iterator(); it.hasNext(); )
|
for ( Iterator it = children().iterator(); it.hasNext(); )
|
||||||
{
|
{
|
||||||
MarmaladeTag child = (MarmaladeTag) it.next();
|
it.next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.apache.maven.script.marmalade.tags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jdcasey Created on Feb 8, 2005
|
||||||
|
*/
|
||||||
|
public class InheritByDefaultTag
|
||||||
|
extends AbstractBooleanValuedBodyTag
|
||||||
|
{
|
||||||
|
|
||||||
|
protected void setValue( Boolean value ) throws MarmaladeExecutionException
|
||||||
|
{
|
||||||
|
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||||
|
metadataTag.setInheritByDefault( value.booleanValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -49,10 +49,18 @@ public class MetadataTag
|
||||||
|
|
||||||
private List parameters = new ArrayList();
|
private List parameters = new ArrayList();
|
||||||
|
|
||||||
private String lifecyclePhase;
|
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
private boolean aggregator = false;
|
||||||
|
|
||||||
|
private boolean inheritByDefault = true;
|
||||||
|
|
||||||
|
private boolean requiresOnline;
|
||||||
|
|
||||||
|
private String executePhase;
|
||||||
|
|
||||||
|
private String executeLifecycle;
|
||||||
|
|
||||||
protected boolean alwaysProcessChildren()
|
protected boolean alwaysProcessChildren()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -99,6 +107,16 @@ public class MetadataTag
|
||||||
descriptor.setInstantiationStrategy( instantiationStrategy );
|
descriptor.setInstantiationStrategy( instantiationStrategy );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( notEmpty( executeLifecycle ) )
|
||||||
|
{
|
||||||
|
descriptor.setExecuteLifecycle( executeLifecycle );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( notEmpty( executePhase ) )
|
||||||
|
{
|
||||||
|
descriptor.setExecutePhase( executePhase );
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
descriptor.setParameters( parameters );
|
descriptor.setParameters( parameters );
|
||||||
|
@ -110,6 +128,9 @@ public class MetadataTag
|
||||||
|
|
||||||
descriptor.setDependencyResolutionRequired( requiresDependencyResolution );
|
descriptor.setDependencyResolutionRequired( requiresDependencyResolution );
|
||||||
descriptor.setProjectRequired( requiresProject );
|
descriptor.setProjectRequired( requiresProject );
|
||||||
|
descriptor.setAggregator( aggregator );
|
||||||
|
descriptor.setInheritedByDefault( inheritByDefault );
|
||||||
|
descriptor.setOnlineRequired( requiresOnline );
|
||||||
|
|
||||||
String basePath = (String) context.getVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR,
|
String basePath = (String) context.getVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR,
|
||||||
getExpressionEvaluator() );
|
getExpressionEvaluator() );
|
||||||
|
@ -136,11 +157,6 @@ public class MetadataTag
|
||||||
return test != null && test.trim().length() > 0;
|
return test != null && test.trim().length() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLifecyclePhase( String lifecyclePhase )
|
|
||||||
{
|
|
||||||
this.lifecyclePhase = lifecyclePhase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGoal( String goal )
|
public void setGoal( String goal )
|
||||||
{
|
{
|
||||||
this.goal = goal;
|
this.goal = goal;
|
||||||
|
@ -176,4 +192,29 @@ public class MetadataTag
|
||||||
this.parameters = parameters;
|
this.parameters = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAggregator( boolean aggregator )
|
||||||
|
{
|
||||||
|
this.aggregator = aggregator;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInheritByDefault( boolean inheritByDefault )
|
||||||
|
{
|
||||||
|
this.inheritByDefault = inheritByDefault;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRequiresOnline( boolean requiresOnline )
|
||||||
|
{
|
||||||
|
this.requiresOnline = requiresOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExecutePhase( String executePhase )
|
||||||
|
{
|
||||||
|
this.executePhase = executePhase;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExecuteLifecycle( String executeLifecycle )
|
||||||
|
{
|
||||||
|
this.executeLifecycle = executeLifecycle;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -32,13 +32,15 @@ public class MojoDefinitionTagLibrary
|
||||||
registerTag( "executionStrategy", ExecutionStrategyTag.class );
|
registerTag( "executionStrategy", ExecutionStrategyTag.class );
|
||||||
registerTag( "goal", GoalTag.class );
|
registerTag( "goal", GoalTag.class );
|
||||||
registerTag( "instantiationStrategy", InstantiationStrategyTag.class );
|
registerTag( "instantiationStrategy", InstantiationStrategyTag.class );
|
||||||
registerTag( "lifecyclePhase", LifecyclePhaseTag.class );
|
|
||||||
registerTag( "metadata", MetadataTag.class );
|
registerTag( "metadata", MetadataTag.class );
|
||||||
registerTag( "mojo", MojoTag.class );
|
registerTag( "mojo", MojoTag.class );
|
||||||
registerTag( "parameters", ParametersTag.class );
|
registerTag( "parameters", ParametersTag.class );
|
||||||
registerTag( "parameter", ParameterTag.class );
|
registerTag( "parameter", ParameterTag.class );
|
||||||
registerTag( "requiresDependencyResolution", RequiresDependencyResolutionTag.class );
|
registerTag( "requiresDependencyResolution", RequiresDependencyResolutionTag.class );
|
||||||
registerTag( "requiresProject", RequiresProjectTag.class );
|
registerTag( "requiresProject", RequiresProjectTag.class );
|
||||||
|
registerTag( "requiresOnline", RequiresOnlineTag.class );
|
||||||
|
registerTag( "inheritByDefault", InheritByDefaultTag.class );
|
||||||
|
registerTag( "aggregator", AggregatorTag.class );
|
||||||
registerTag( "name", ParamNameTag.class );
|
registerTag( "name", ParamNameTag.class );
|
||||||
registerTag( "expression", ParamExpressionTag.class );
|
registerTag( "expression", ParamExpressionTag.class );
|
||||||
registerTag( "type", ParamTypeTag.class );
|
registerTag( "type", ParamTypeTag.class );
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class ParameterTag
|
||||||
|
|
||||||
private boolean required = true;
|
private boolean required = true;
|
||||||
|
|
||||||
|
private String defaultVal;
|
||||||
|
|
||||||
protected void doExecute( MarmaladeExecutionContext context )
|
protected void doExecute( MarmaladeExecutionContext context )
|
||||||
throws MarmaladeExecutionException
|
throws MarmaladeExecutionException
|
||||||
{
|
{
|
||||||
|
@ -62,6 +64,7 @@ public class ParameterTag
|
||||||
param.setRequired( required );
|
param.setRequired( required );
|
||||||
param.setType( type );
|
param.setType( type );
|
||||||
param.setDeprecated( deprecated );
|
param.setDeprecated( deprecated );
|
||||||
|
param.setDefaultValue( defaultVal );
|
||||||
|
|
||||||
return param;
|
return param;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +91,7 @@ public class ParameterTag
|
||||||
|
|
||||||
public void setDefault( String defaultVal )
|
public void setDefault( String defaultVal )
|
||||||
{
|
{
|
||||||
|
this.defaultVal = defaultVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRequired( boolean required )
|
public void setRequired( boolean required )
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.apache.maven.script.marmalade.tags;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2004 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.codehaus.marmalade.runtime.MarmaladeExecutionException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jdcasey Created on Feb 8, 2005
|
||||||
|
*/
|
||||||
|
public class RequiresOnlineTag
|
||||||
|
extends AbstractBooleanValuedBodyTag
|
||||||
|
{
|
||||||
|
|
||||||
|
protected void setValue( Boolean value ) throws MarmaladeExecutionException
|
||||||
|
{
|
||||||
|
MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class );
|
||||||
|
metadataTag.setRequiresOnline( value.booleanValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue