diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/pom.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/pom.xml new file mode 100644 index 0000000..29ccc6b --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + + + test + maven-since-3.x + 1.0-SNAPSHOT + + + test + antsample-maven-plugin + maven-plugin + ANT Sample + Just a test project + http://nowere.test + 2012 + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + + org.apache.maven.plugin-tools + maven-plugin-tools-ant + @project.version@ + + + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.build.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.build.xml new file mode 100644 index 0000000..227badb --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.build.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.mojos.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.mojos.xml new file mode 100644 index 0000000..392ad61 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/main/scripts/sample.mojos.xml @@ -0,0 +1,25 @@ + + + + + sample + sample-task + Just a test + false + false + 1.0 + + + + message + java.lang.String + true + false + 0.9 + Test param + + + + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/site/site.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/site/site.xml new file mode 100644 index 0000000..1efa9c7 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/antsample-maven-plugin/src/site/site.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + ${reports} + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/invoker.properties b/maven-plugin-plugin/src/it/fix-maven-since-3.x/invoker.properties new file mode 100644 index 0000000..2f42a25 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/invoker.properties @@ -0,0 +1,3 @@ +invoker.goals.1 = clean install site + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/pom.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/pom.xml new file mode 100644 index 0000000..54187f8 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/pom.xml @@ -0,0 +1,30 @@ + + 4.0.0 + + + test + maven-since-3.x + 1.0-SNAPSHOT + + + test + javasample-maven-plugin + maven-plugin + + Java Sample + Java Maven Mojo. + http://maven.apache.org + + + UTF-8 + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/main/java/test/MyMojo.java b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/main/java/test/MyMojo.java new file mode 100644 index 0000000..ee28d9e --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/main/java/test/MyMojo.java @@ -0,0 +1,82 @@ +package test; + +/* + * Copyright 2001-2005 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.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * Goal which touches a timestamp file. + * + * @goal touch + * @since 1.0 + * + * @phase process-sources + */ +public class MyMojo + extends AbstractMojo +{ + /** + * Location of the file. + * @parameter property="project.build.directory" + * @required + */ + private File outputDirectory; + + public void execute() + throws MojoExecutionException + { + File f = outputDirectory; + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + FileWriter w = null; + try + { + w = new FileWriter( touch ); + + w.write( "touch.txt" ); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error creating file " + touch, e ); + } + finally + { + if ( w != null ) + { + try + { + w.close(); + } + catch ( IOException e ) + { + // ignore + } + } + } + } +} diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/site/site.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/site/site.xml new file mode 100644 index 0000000..ebb29e1 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/javasample-maven-plugin/src/site/site.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + ${reports} + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/pom.xml b/maven-plugin-plugin/src/it/fix-maven-since-3.x/pom.xml new file mode 100644 index 0000000..9b8f1da --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + test + maven-since-3.x + 1.0-SNAPSHOT + Samples + pom + Just a test project + http://nowere.test + 2012 + + + antsample-maven-plugin + javasample-maven-plugin + + + + + org.codehaus.plexus + plexus-utils + 3.0 + + + + + + + maven-plugin-plugin + 3.1 + + + generated-helpmojo + + helpmojo + + + + + + org.apache.maven.plugin-tools + maven-plugin-tools-ant + 3.1 + + + + + org.apache.maven.plugins + maven-site-plugin + 3.0 + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.4 + + + org.apache.maven.plugins + maven-help-plugin + 2.1.1 + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.1 + + + + diff --git a/maven-plugin-plugin/src/it/fix-maven-since-3.x/verify.groovy b/maven-plugin-plugin/src/it/fix-maven-since-3.x/verify.groovy new file mode 100644 index 0000000..2af0eb2 --- /dev/null +++ b/maven-plugin-plugin/src/it/fix-maven-since-3.x/verify.groovy @@ -0,0 +1,8 @@ +File touchFile = new File( basedir, "antsample-maven-plugin/target/site/sample-mojo.html" ) +assert touchFile.exists() +assert touchFile.isFile() +content = touchFile.text +assert content.contains('Since'); + + +return true; diff --git a/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java b/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java index 40a4772..9af043a 100644 --- a/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java +++ b/maven-plugin-tools-model/src/main/java/org/apache/maven/plugin/tools/model/PluginMetadataParser.java @@ -126,6 +126,7 @@ public class PluginMetadataParser descriptor.setRequiresReports( mojo.isRequiresReports() ); descriptor.setDescription( mojo.getDescription() ); descriptor.setDeprecated( mojo.getDeprecation() ); + descriptor.setSince( mojo.getSince() ); LifecycleExecution le = mojo.getExecution(); if ( le != null ) @@ -147,6 +148,7 @@ public class PluginMetadataParser dParam.setEditable( !param.isReadonly() ); dParam.setExpression( param.getExpression() ); dParam.setDefaultValue( param.getDefaultValue() ); + dParam.setSince( param.getSince() ); String property = param.getProperty(); if ( StringUtils.isNotEmpty( property ) )