diff --git a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java index f7718a8daf..a43eca6d0a 100755 --- a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java +++ b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java @@ -61,6 +61,8 @@ public class MojoDescriptor private String executeLifecycle; private String deprecated; + + private boolean aggregator = false; // ---------------------------------------------------------------------- // @@ -389,4 +391,14 @@ public class MojoDescriptor { this.executeLifecycle = executeLifecycle; } + + public void setAggregator( boolean aggregator ) + { + this.aggregator = aggregator; + } + + public boolean isAggregator() + { + return aggregator; + } } diff --git a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java index 5f7bceee0a..fb31a9f959 100755 --- a/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java +++ b/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java @@ -167,6 +167,13 @@ public class PluginDescriptorBuilder 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(); if ( requiresOnline != null ) diff --git a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java index c770a7c210..55a0994ff6 100644 --- a/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java +++ b/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java @@ -132,6 +132,12 @@ public class PluginDescriptorGenerator // // ---------------------------------------------------------------------- + element( w, "aggregator", "" + mojoDescriptor.isAggregator() ); + + // ---------------------------------------------------------------------- + // + // ---------------------------------------------------------------------- + element( w, "requiresOnline", "" + mojoDescriptor.isOnlineRequired() ); // ---------------------------------------------------------------------- diff --git a/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java b/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java index 7e9474fd7e..049013855f 100644 --- a/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java +++ b/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java @@ -51,6 +51,7 @@ public class JavaMojoDescriptorExtractor implements MojoDescriptorExtractor { public static final String MAVEN_PLUGIN_INSTANTIATION = "instantiationStrategy"; + public static final String CONFIGURATOR = "configurator"; public static final String PARAMETER = "parameter"; @@ -76,6 +77,8 @@ public class JavaMojoDescriptorExtractor public static final String GOAL_REQUIRES_DEPENDENCY_RESOLUTION = "requiresDependencyResolution"; public static final String GOAL_REQUIRES_PROJECT = "requiresProject"; + + public static final String GOAL_IS_AGGREGATOR = "aggregator"; public static final String GOAL_REQUIRES_ONLINE = "requiresOnline"; @@ -236,6 +239,17 @@ public class JavaMojoDescriptorExtractor mojoDescriptor.setProjectRequired( true ); } + // ---------------------------------------------------------------------- + // Aggregator flag + // ---------------------------------------------------------------------- + + DocletTag aggregator = findInClassHierarchy( javaClass, GOAL_IS_AGGREGATOR ); + + if ( aggregator != null ) + { + mojoDescriptor.setAggregator( true ); + } + // ---------------------------------------------------------------------- // Online flag // ---------------------------------------------------------------------- diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/AggregatorTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/AggregatorTag.java new file mode 100644 index 0000000000..9382e7c25e --- /dev/null +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/AggregatorTag.java @@ -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() ); + } + +} \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteLifecycleTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteLifecycleTag.java new file mode 100644 index 0000000000..f447587c6e --- /dev/null +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteLifecycleTag.java @@ -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 ); + } + +} \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/LifecyclePhaseTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecutePhaseTag.java similarity index 92% rename from maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/LifecyclePhaseTag.java rename to maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecutePhaseTag.java index d64a5675d2..2ff309ec39 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/LifecyclePhaseTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecutePhaseTag.java @@ -21,14 +21,14 @@ import org.codehaus.marmalade.runtime.MarmaladeExecutionException; /** * @author jdcasey Created on Feb 8, 2005 */ -public class LifecyclePhaseTag +public class ExecutePhaseTag extends AbstractStringValuedBodyTag { protected void setValue( String value ) throws MarmaladeExecutionException { MetadataTag metadataTag = (MetadataTag) requireParent( MetadataTag.class ); - metadataTag.setLifecyclePhase( value ); + metadataTag.setExecutePhase( value ); } } \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteTag.java index a3a3e1c476..46170e77d5 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ExecuteTag.java @@ -17,7 +17,6 @@ package org.apache.maven.script.marmalade.tags; */ import org.codehaus.marmalade.model.AbstractMarmaladeTag; -import org.codehaus.marmalade.model.MarmaladeTag; import org.codehaus.marmalade.runtime.MarmaladeExecutionContext; import org.codehaus.marmalade.runtime.MarmaladeExecutionException; @@ -37,7 +36,7 @@ public class ExecuteTag { for ( Iterator it = children().iterator(); it.hasNext(); ) { - MarmaladeTag child = (MarmaladeTag) it.next(); + it.next(); } } diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/InheritByDefaultTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/InheritByDefaultTag.java new file mode 100644 index 0000000000..ba4c8b727c --- /dev/null +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/InheritByDefaultTag.java @@ -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() ); + } + +} \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java index a02dc4c66a..8f77f08583 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MetadataTag.java @@ -49,10 +49,18 @@ public class MetadataTag private List parameters = new ArrayList(); - private String lifecyclePhase; - private String description; + private boolean aggregator = false; + + private boolean inheritByDefault = true; + + private boolean requiresOnline; + + private String executePhase; + + private String executeLifecycle; + protected boolean alwaysProcessChildren() { return false; @@ -99,6 +107,16 @@ public class MetadataTag descriptor.setInstantiationStrategy( instantiationStrategy ); } + if ( notEmpty( executeLifecycle ) ) + { + descriptor.setExecuteLifecycle( executeLifecycle ); + } + + if ( notEmpty( executePhase ) ) + { + descriptor.setExecutePhase( executePhase ); + } + try { descriptor.setParameters( parameters ); @@ -110,6 +128,9 @@ public class MetadataTag descriptor.setDependencyResolutionRequired( requiresDependencyResolution ); descriptor.setProjectRequired( requiresProject ); + descriptor.setAggregator( aggregator ); + descriptor.setInheritedByDefault( inheritByDefault ); + descriptor.setOnlineRequired( requiresOnline ); String basePath = (String) context.getVariable( MarmaladeMojoExecutionDirectives.SCRIPT_BASEPATH_INVAR, getExpressionEvaluator() ); @@ -136,11 +157,6 @@ public class MetadataTag return test != null && test.trim().length() > 0; } - public void setLifecyclePhase( String lifecyclePhase ) - { - this.lifecyclePhase = lifecyclePhase; - } - public void setGoal( String goal ) { this.goal = goal; @@ -176,4 +192,29 @@ public class MetadataTag 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; + } + } \ No newline at end of file diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java index 4d007ecd3b..b6d51451dd 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/MojoDefinitionTagLibrary.java @@ -32,13 +32,15 @@ public class MojoDefinitionTagLibrary registerTag( "executionStrategy", ExecutionStrategyTag.class ); registerTag( "goal", GoalTag.class ); registerTag( "instantiationStrategy", InstantiationStrategyTag.class ); - registerTag( "lifecyclePhase", LifecyclePhaseTag.class ); registerTag( "metadata", MetadataTag.class ); registerTag( "mojo", MojoTag.class ); registerTag( "parameters", ParametersTag.class ); registerTag( "parameter", ParameterTag.class ); registerTag( "requiresDependencyResolution", RequiresDependencyResolutionTag.class ); registerTag( "requiresProject", RequiresProjectTag.class ); + registerTag( "requiresOnline", RequiresOnlineTag.class ); + registerTag( "inheritByDefault", InheritByDefaultTag.class ); + registerTag( "aggregator", AggregatorTag.class ); registerTag( "name", ParamNameTag.class ); registerTag( "expression", ParamExpressionTag.class ); registerTag( "type", ParamTypeTag.class ); diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java index 7f705863d7..f39e21b85c 100644 --- a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java @@ -41,6 +41,8 @@ public class ParameterTag private boolean required = true; + private String defaultVal; + protected void doExecute( MarmaladeExecutionContext context ) throws MarmaladeExecutionException { @@ -62,6 +64,7 @@ public class ParameterTag param.setRequired( required ); param.setType( type ); param.setDeprecated( deprecated ); + param.setDefaultValue( defaultVal ); return param; } @@ -88,6 +91,7 @@ public class ParameterTag public void setDefault( String defaultVal ) { + this.defaultVal = defaultVal; } public void setRequired( boolean required ) diff --git a/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresOnlineTag.java b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresOnlineTag.java new file mode 100644 index 0000000000..31b6d1ed8b --- /dev/null +++ b/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/RequiresOnlineTag.java @@ -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() ); + } + +} \ No newline at end of file