You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2012/05/20 00:42:30 UTC
svn commit: r1340586 - in /maven/plugin-tools/trunk:
maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/
maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/
maven-plugin-plugin/src/it/annotation-with-inheritance-rea...
Author: hboutemy
Date: Sat May 19 22:42:30 2012
New Revision: 1340586
URL: http://svn.apache.org/viewvc?rev=1340586&view=rev
Log:
removed readonly parameter to @Parameter annotation since this attribute was only useful when @Component didn't exist
Modified:
maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/module-abstract-mojo/src/main/java/org/apache/maven/plugins/AbstractFirstMojo.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/verify.groovy
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java
maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java
maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java
Modified: maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-annotations/src/main/java/org/apache/maven/plugins/annotations/Parameter.java Sat May 19 22:42:30 2012
@@ -64,16 +64,4 @@ public @interface Parameter
* @return <code>true</code> if the Mojo should fail when the parameter cannot be injected
*/
boolean required() default false;
-
- /**
- * Specifies that this parameter cannot be configured directly by the user (as in the case of POM-specified
- * configuration). This is useful when you want to force the user to use common POM elements rather than plugin
- * configurations, as in the case where you want to use the artifact's final name as a parameter. In this case, you
- * want the user to modify <code><build><finalName/></build></code> rather than specifying a value
- * for finalName directly in the plugin configuration section. It is also useful to ensure that - for example - a
- * List-typed parameter which expects items of type Artifact doesn't get a List full of Strings.
- *
- * @return <code>true</code> if the user should not be allowed to configure the parameter directly
- */
- boolean readonly() default false;
}
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/module-abstract-mojo/src/main/java/org/apache/maven/plugins/AbstractFirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/module-abstract-mojo/src/main/java/org/apache/maven/plugins/AbstractFirstMojo.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/module-abstract-mojo/src/main/java/org/apache/maven/plugins/AbstractFirstMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/module-abstract-mojo/src/main/java/org/apache/maven/plugins/AbstractFirstMojo.java Sat May 19 22:42:30 2012
@@ -42,7 +42,7 @@ public abstract class AbstractFirstMojo
/**
* Project directory.
*/
- @Parameter( defaultValue = "${basedir}", readonly = true )
+ @Parameter( defaultValue = "${basedir}" )
protected File basedir;
@Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt",
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/verify.groovy?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/verify.groovy (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance-reactor/verify.groovy Sat May 19 22:42:30 2012
@@ -69,7 +69,7 @@ assert parameter.alias.isEmpty()
assert parameter.type.text() == 'java.io.File'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'false'
-assert parameter.editable.text() == 'false'
+assert parameter.editable.text() == 'true'
assert parameter.description.text() == 'Project directory.'
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/AbstractFirstMojo.java Sat May 19 22:42:30 2012
@@ -42,7 +42,7 @@ public abstract class AbstractFirstMojo
/**
* Project directory.
*/
- @Parameter( defaultValue = "${basedir}", readonly = true )
+ @Parameter( defaultValue = "${basedir}" )
protected File basedir;
@Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt",
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java Sat May 19 22:42:30 2012
@@ -53,7 +53,7 @@ public class FirstMojo
@Component( role = "org.apache.maven.project.MavenProjectHelper" )//, roleHint = "default"
private Object projectHelper;
- @Parameter( defaultValue = "${project.artifacts}", required = true, readonly = true )
+ @Parameter( defaultValue = "${project.artifacts}", required = true )
private Set<Artifact> dependencies;
public void execute()
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/annotation-with-inheritance/verify.groovy Sat May 19 22:42:30 2012
@@ -73,7 +73,7 @@ assert parameter.alias.isEmpty()
assert parameter.type.text() == 'java.io.File'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'false'
-assert parameter.editable.text() == 'false'
+assert parameter.editable.text() == 'true'
assert parameter.description.text() == 'Project directory.'
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second"}[0]
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java Sat May 19 22:42:30 2012
@@ -45,7 +45,7 @@ public class FirstMojo
/**
* Project directory.
*/
- @Parameter( defaultValue = "${basedir}", readonly = true )
+ @Parameter( defaultValue = "${basedir}" )
private File basedir;
@Parameter( property = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt",
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic-annotations/verify.groovy Sat May 19 22:42:30 2012
@@ -67,7 +67,7 @@ assert parameter.alias.isEmpty()
assert parameter.type.text() == 'java.io.File'
assert parameter.deprecated.isEmpty()
assert parameter.required.text() == 'false'
-assert parameter.editable.text() == 'false'
+assert parameter.editable.text() == 'true'
assert parameter.description.text() == 'Project directory.'
mojo = pluginDescriptor.mojos.mojo.findAll{ it.goal.text() == "second" }[0]
Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/plugin-report-annotations/src/main/java/org/DummyReport.java Sat May 19 22:42:30 2012
@@ -58,7 +58,7 @@ public class DummyReport
/**
* The Maven Project.
*/
- @Parameter( property = "project", readonly = true, required = true )
+ @Parameter( property = "project", required = true )
private MavenProject project;
Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/JavaAnnotationsMojoDescriptorExtractor.java Sat May 19 22:42:30 2012
@@ -490,7 +490,6 @@ public class JavaAnnotationsMojoDescript
parameter.setDefaultValue( parameterAnnotationContent.defaultValue() );
parameter.setDeprecated( parameterAnnotationContent.getDeprecated() );
parameter.setDescription( parameterAnnotationContent.getDescription() );
- parameter.setEditable( !parameterAnnotationContent.readonly() );
String property = parameterAnnotationContent.property();
if ( StringUtils.contains( property, '$' ) || StringUtils.contains( property, '{' )
|| StringUtils.contains( property, '}' ) )
Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/main/java/org/apache/maven/tools/plugin/annotations/datamodel/ParameterAnnotationContent.java Sat May 19 22:42:30 2012
@@ -40,8 +40,6 @@ public class ParameterAnnotationContent
private boolean required = false;
- private boolean readonly = false;
-
private String className;
public ParameterAnnotationContent( String fieldName, String className )
@@ -51,14 +49,13 @@ public class ParameterAnnotationContent
}
public ParameterAnnotationContent( String fieldName, String alias, String property, String defaultValue,
- boolean required, boolean readonly, String className )
+ boolean required, String className )
{
this( fieldName, className );
this.alias = alias;
this.property = property;
this.defaultValue = defaultValue;
this.required = required;
- this.readonly = readonly;
}
public String alias()
@@ -101,16 +98,6 @@ public class ParameterAnnotationContent
this.required = required;
}
- public boolean readonly()
- {
- return readonly;
- }
-
- public void readonly( boolean readonly )
- {
- this.readonly = readonly;
- }
-
public Class<? extends Annotation> annotationType()
{
return null;
@@ -136,7 +123,6 @@ public class ParameterAnnotationContent
sb.append( ", property='" ).append( property ).append( '\'' );
sb.append( ", defaultValue='" ).append( defaultValue ).append( '\'' );
sb.append( ", required=" ).append( required );
- sb.append( ", readonly=" ).append( readonly );
sb.append( '}' );
return sb.toString();
}
@@ -155,10 +141,6 @@ public class ParameterAnnotationContent
ParameterAnnotationContent that = (ParameterAnnotationContent) o;
- if ( readonly != that.readonly )
- {
- return false;
- }
if ( required != that.required )
{
return false;
@@ -193,7 +175,6 @@ public class ParameterAnnotationContent
result = 31 * result + ( property != null ? property.hashCode() : 0 );
result = 31 * result + ( defaultValue != null ? defaultValue.hashCode() : 0 );
result = 31 * result + ( required ? 1 : 0 );
- result = 31 * result + ( readonly ? 1 : 0 );
return result;
}
}
Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java?rev=1340586&r1=1340585&r2=1340586&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/test/java/org/apache/maven/tools/plugin/annotations/TestAnnotationsReader.java Sat May 19 22:42:30 2012
@@ -83,8 +83,7 @@ public class TestAnnotationsReader
Collection<ParameterAnnotationContent> parameters = mojoAnnotatedClass.getParameters().values();
Assertions.assertThat( parameters ).isNotNull().isNotEmpty().hasSize( 2 ).contains(
- new ParameterAnnotationContent( "bar", null, "thebar", "coolbar", true, false, String.class.getName() ),
- new ParameterAnnotationContent( "beer", null, "thebeer", "coolbeer", false, false,
- String.class.getName() ) );
+ new ParameterAnnotationContent( "bar", null, "thebar", "coolbar", true, String.class.getName() ),
+ new ParameterAnnotationContent( "beer", null, "thebeer", "coolbeer", false, String.class.getName() ) );
}
}