maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1337816 - in /maven/plugin-tools/trunk: maven-plugin-plugin/src/it/java-basic-annotations/src/main/java/org/apache/maven/plugin/coreit/ maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/ maven-plugin-tools-...
Date Sun, 13 May 2012 09:04:24 GMT
Author: hboutemy
Date: Sun May 13 09:04:24 2012
New Revision: 1337816

URL: http://svn.apache.org/viewvc?rev=1337816&view=rev
Log:
[MPLUGIN-194] support expression="a property" in addition to expression="${a property}"

Modified:
    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/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
    maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt
    maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/site/apt/index.apt

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=1337816&r1=1337815&r2=1337816&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
Sun May 13 09:04:24 2012
@@ -48,7 +48,7 @@ public class FirstMojo
     @Parameter( defaultValue = "${basedir}", readonly = true )
     private File basedir;
 
-    @Parameter( expression = "${first.touchFile}", defaultValue = "${project.build.directory}/touch.txt",
+    @Parameter( expression = "first.touchFile", defaultValue = "${project.build.directory}/touch.txt",
                 required = true )
     private File touchFile;
 

Modified: maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic/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/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java?rev=1337816&r1=1337815&r2=1337816&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/FirstMojo.java
Sun May 13 09:04:24 2012
@@ -47,7 +47,7 @@ public class FirstMojo
     private File basedir;
     
     /**
-     * @parameter expression="${first.touchFile}" default-value="${project.build.directory}/touch.txt"
+     * @parameter expression="first.touchFile" default-value="${project.build.directory}/touch.txt"
      * @required
      */
     private File touchFile;

Modified: maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt?rev=1337816&r1=1337815&r2=1337816&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-annotations/src/site/apt/index.apt Sun May
13 09:04:24 2012
@@ -74,7 +74,7 @@ public class MyMojo
      * @deprecated <deprecated-text>
      */
     @Parameter( alias = "myAlias",
-                expression = "${aSystemProperty}",
+                expression = "aSystemProperty",
                 defaultValue = "${anExpression}",
                 readonly = <false|true>
                 required = <false|true> )
@@ -97,6 +97,7 @@ public class MyMojo
 }
 +---------+
 
+
 * See also
 
  * {{{../maven-plugin-annotations/index.html}Maven Plugin Tools Java 5 Annotations}}

Modified: maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java?rev=1337816&r1=1337815&r2=1337816&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
(original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/generator/PluginDescriptorGenerator.java
Sun May 13 09:04:24 2012
@@ -420,7 +420,7 @@ public class PluginDescriptorGenerator
         {
             for ( Parameter parameter : parameters )
             {
-                String expression = parameter.getExpression();
+                String expression = getExpression( parameter );
 
                 if ( StringUtils.isNotEmpty( expression ) && expression.startsWith(
"${component." ) )
                 {
@@ -571,6 +571,23 @@ public class PluginDescriptorGenerator
         w.endElement();
     }
 
+    /**
+     * Get the expression value, eventually surrounding it with <code>${ }</code>.
+     * 
+     * @param parameter the parameter
+     * @return the expression value
+     */
+    private String getExpression( Parameter parameter )
+    {
+        String expression = parameter.getExpression();
+        if ( StringUtils.isNotBlank( expression ) && !expression.contains( "${" )
)
+        {
+            expression = "${" + expression.trim() + "}";
+            parameter.setExpression( expression );
+        }
+        return expression;
+    }
+
     protected String rewriteHelpClassToMojoPackage( PluginToolsRequest request )
         throws GeneratorException
     {

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/site/apt/index.apt?rev=1337816&r1=1337815&r2=1337816&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/site/apt/index.apt (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/site/apt/index.apt Sun May 13 09:04:24
2012
@@ -62,7 +62,7 @@ public class MyMojo
     extends AbstractMojo
 {
     /**
-     * @parameter alias="myAlias" implementation="" expression="${aSystemProperty}" default-value="${anExpression}"
+     * @parameter alias="myAlias" implementation="" expression="aSystemProperty" default-value="${anExpression}"
      * @readonly
      * @required
      * @since <since-text>
@@ -86,6 +86,9 @@ public class MyMojo
 }
 +---------+
 
+  <<Notice>>: before 3.0, <<<${ }>>> were required for <<<expression>>>
value (<<<expression="${aSystemProperty}">>>),
+  but starting with 3.0, you can omit it (<<<expression="aSystemProperty">>>)
+
 * See also
 
  * {{{/developers/mojo-api-specification.html#The_Descriptor_and_Annotations}Mojo API Specification}}



Mime
View raw message