You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/04/20 18:49:01 UTC
cvs commit: maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags ParameterTag.java
brett 2005/04/20 09:49:01
Modified: maven-core/src/main/java/org/apache/maven/plugin
DefaultPluginManager.java
maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java
JavaMojoDescriptorExtractor.java
maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade
MarmaladeMojoDescriptorExtractor.java
maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator
PluginDescriptorGenerator.java
maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor
MojoDescriptor.java Parameter.java
PluginDescriptorBuilder.java
maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags
ParameterTag.java
Log:
add deprecated parameter feature
Revision Changes Path
1.85 +9 -0 maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
Index: DefaultPluginManager.java
===================================================================
RCS file: /home/cvs/maven-components/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -r1.84 -r1.85
--- DefaultPluginManager.java 20 Apr 2005 16:41:35 -0000 1.84
+++ DefaultPluginManager.java 20 Apr 2005 16:49:01 -0000 1.85
@@ -657,6 +657,15 @@
else
{
expression = configuration.getChild( key, false ).getValue( null );
+
+ if ( expression != null && parameter.getDeprecated() != null )
+ {
+ if ( !expression.equals( goal.getConfiguration().getChild( key, false ).getValue( null ) ) )
+ {
+ getLogger().warn(
+ "DEPRECATED: " + parameter.getName() + " is deprecated.\n\t" + parameter.getDeprecated() );
+ }
+ }
}
Object value = expressionEvaluator.evaluate( expression );
1.10 +2 -0 maven-components/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java
Index: JavaMojoDescriptorExtractor.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-tools/maven-plugin-tools-java/src/main/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractor.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- JavaMojoDescriptorExtractor.java 13 Apr 2005 11:34:09 -0000 1.9
+++ JavaMojoDescriptorExtractor.java 20 Apr 2005 16:49:01 -0000 1.10
@@ -216,6 +216,8 @@
pd.setDefaultValue( parameter.getNamedParameter( "default" ) );
+ pd.setDeprecated( parameter.getNamedParameter( "deprecated" ) );
+
parameters.add( pd );
}
1.6 +10 -15 maven-components/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java
Index: MarmaladeMojoDescriptorExtractor.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-tools/maven-plugin-tools-marmalade/src/main/java/org/apache/maven/tools/plugin/extractor/marmalade/MarmaladeMojoDescriptorExtractor.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MarmaladeMojoDescriptorExtractor.java 4 Mar 2005 09:04:20 -0000 1.5
+++ MarmaladeMojoDescriptorExtractor.java 20 Apr 2005 16:49:01 -0000 1.6
@@ -28,6 +28,7 @@
import org.codehaus.marmalade.parsing.ScriptParser;
import org.codehaus.marmalade.runtime.DefaultContext;
import org.codehaus.marmalade.runtime.MarmaladeExecutionContext;
+import org.codehaus.plexus.util.IOUtil;
import java.io.BufferedReader;
import java.io.File;
@@ -50,7 +51,8 @@
return ".mmld";
}
- protected Set extractMojoDescriptors( Map sourceFilesKeyedByBasedir ) throws Exception
+ protected Set extractMojoDescriptors( Map sourceFilesKeyedByBasedir )
+ throws Exception
{
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
try
@@ -84,14 +86,15 @@
contextMap = context.getExternalizedVariables();
- MojoDescriptor descriptor = (MojoDescriptor) contextMap.get( MarmaladeMojoExecutionDirectives.METADATA_OUTVAR );
+ MojoDescriptor descriptor = (MojoDescriptor) contextMap.get(
+ MarmaladeMojoExecutionDirectives.METADATA_OUTVAR );
descriptors.add( descriptor );
}
else
{
- System.out.println( "This script is not a mojo. Its root tag is {element: "
- + rootTag.getTagInfo().getElement() + ", class: " + rootTag.getClass().getName() + "}" );
+ System.out.println( "This script is not a mojo. Its root tag is {element: " +
+ rootTag.getTagInfo().getElement() + ", class: " + rootTag.getClass().getName() + "}" );
}
}
}
@@ -104,7 +107,8 @@
}
}
- private MarmaladeScript parse( File scriptFile ) throws Exception
+ private MarmaladeScript parse( File scriptFile )
+ throws Exception
{
BufferedReader reader = null;
@@ -127,16 +131,7 @@
}
finally
{
- if ( reader != null )
- {
- try
- {
- reader.close();
- }
- catch ( Exception e )
- {
- }
- }
+ IOUtil.close( reader );
}
}
1.10 +5 -0 maven-components/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
Index: PluginDescriptorGenerator.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-tools/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- PluginDescriptorGenerator.java 15 Apr 2005 04:52:30 -0000 1.9
+++ PluginDescriptorGenerator.java 20 Apr 2005 16:49:01 -0000 1.10
@@ -175,6 +175,11 @@
element( w, "type", parameter.getType() );
+ if ( parameter.getDeprecated() != null )
+ {
+ element( w, "deprecated", parameter.getDeprecated() );
+ }
+
element( w, "validator", parameter.getValidator() );
String value = null;
1.5 +13 -1 maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java
Index: MojoDescriptor.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/MojoDescriptor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- MojoDescriptor.java 18 Apr 2005 21:50:55 -0000 1.4
+++ MojoDescriptor.java 20 Apr 2005 16:49:01 -0000 1.5
@@ -59,6 +59,8 @@
private List requirements;
+ private String deprecated;
+
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@@ -66,7 +68,7 @@
private String requiresDependencyResolution = null;
private boolean requiresProject = true;
-
+
private boolean requiresOnline = false;
private String language = DEFAULT_LANGUAGE;
@@ -127,6 +129,16 @@
this.id = id;
}
+ public String getDeprecated()
+ {
+ return deprecated;
+ }
+
+ public void setDeprecated( String deprecated )
+ {
+ this.deprecated = deprecated;
+ }
+
public List getParameters()
{
return parameters;
1.2 +13 -1 maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java
Index: Parameter.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/Parameter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Parameter.java 13 Apr 2005 05:08:29 -0000 1.1
+++ Parameter.java 20 Apr 2005 16:49:01 -0000 1.2
@@ -36,6 +36,8 @@
private String defaultValue;
+ private String deprecated;
+
// ----------------------------------------------------------------------
//
// ----------------------------------------------------------------------
@@ -109,4 +111,14 @@
{
this.defaultValue = defaultValue;
}
+
+ public String getDeprecated()
+ {
+ return deprecated;
+ }
+
+ public void setDeprecated( String deprecated )
+ {
+ this.deprecated = deprecated;
+ }
}
1.5 +10 -3 maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java
Index: PluginDescriptorBuilder.java
===================================================================
RCS file: /home/cvs/maven-components/maven-plugin-descriptor/src/main/java/org/apache/maven/plugin/descriptor/PluginDescriptorBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- PluginDescriptorBuilder.java 15 Apr 2005 04:52:31 -0000 1.4
+++ PluginDescriptorBuilder.java 20 Apr 2005 16:49:01 -0000 1.5
@@ -5,7 +5,9 @@
import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+import java.io.IOException;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
@@ -153,6 +155,8 @@
// TODO: remove
parameter.setDefaultValue( d.getChild( "default" ).getValue() );
+ parameter.setDeprecated( d.getChild( "deprecated" ).getValue() );
+
parameters.add( parameter );
}
@@ -194,7 +198,6 @@
//
// ----------------------------------------------------------------------
- // TODO: catches Exception
public PlexusConfiguration buildConfiguration( Reader configuration )
throws PlexusConfigurationException
{
@@ -202,7 +205,11 @@
{
return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) );
}
- catch ( Exception e )
+ catch ( IOException e )
+ {
+ throw new PlexusConfigurationException( "Error creating configuration", e );
+ }
+ catch ( XmlPullParserException e )
{
throw new PlexusConfigurationException( "Error creating configuration", e );
}
1.2 +14 -1 maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java
Index: ParameterTag.java
===================================================================
RCS file: /home/cvs/maven-components/maven-script/maven-script-marmalade/src/main/java/org/apache/maven/script/marmalade/tags/ParameterTag.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ParameterTag.java 24 Feb 2005 05:12:28 -0000 1.1
+++ ParameterTag.java 20 Apr 2005 16:49:01 -0000 1.2
@@ -41,9 +41,12 @@
private String defaultVal;
+ private String deprecated;
+
private boolean required = true;
- protected void doExecute( MarmaladeExecutionContext context ) throws MarmaladeExecutionException
+ protected void doExecute( MarmaladeExecutionContext context )
+ throws MarmaladeExecutionException
{
processChildren( context );
@@ -64,6 +67,7 @@
param.setRequired( required );
param.setType( type );
param.setValidator( validator );
+ param.setDeprecated( deprecated );
return param;
}
@@ -103,4 +107,13 @@
this.required = required;
}
+ public String getDeprecated()
+ {
+ return deprecated;
+ }
+
+ public void setDeprecated( String deprecated )
+ {
+ this.deprecated = deprecated;
+ }
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org