diff --git a/maven-plugin-plugin/pom.xml b/maven-plugin-plugin/pom.xml index 388bd4e..fdaacc8 100644 --- a/maven-plugin-plugin/pom.xml +++ b/maven-plugin-plugin/pom.xml @@ -263,5 +263,51 @@ + + run-its + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + + + + + maven-invoker-plugin + 1.3-SNAPSHOT + + true + ${project.build.directory}/it + + + plugin-report-failure-it/* + + setup.bsh + verify.bsh + ${project.build.directory}/local-repo + src/it/settings.xml + + verify + + + + + integration-test + + install + run + + + + + + + diff --git a/maven-plugin-plugin/src/it/java-basic/invoker.properties b/maven-plugin-plugin/src/it/java-basic/invoker.properties new file mode 100644 index 0000000..71c2d75 --- /dev/null +++ b/maven-plugin-plugin/src/it/java-basic/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals.1 = install +invoker.goals.2 = org.apache.maven.its.it0013:maven-it-it0013:1.0:it0013 diff --git a/maven-plugin-plugin/src/it/java-basic/pom.xml b/maven-plugin-plugin/src/it/java-basic/pom.xml new file mode 100644 index 0000000..071f8d0 --- /dev/null +++ b/maven-plugin-plugin/src/it/java-basic/pom.xml @@ -0,0 +1,54 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it0013 + maven-it-it0013 + 1.0 + maven-plugin + + Maven Integration Test :: it0013 + + Test plugin-plugin, which tests maven-plugin-tools-api and + maven-plugin-tools-java. This will generate a plugin descriptor from + java-based mojo sources, install the plugin, and then use it. + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @project.version@ + + + + diff --git a/maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java b/maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java new file mode 100644 index 0000000..69354f6 --- /dev/null +++ b/maven-plugin-plugin/src/it/java-basic/src/main/java/org/apache/maven/plugin/coreit/CoreIt0013Mojo.java @@ -0,0 +1,67 @@ +package org.apache.maven.plugin.coreit; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.IOException; + +/** + * Touches a test file. + * + * @goal it0013 + */ +public class CoreIt0013Mojo + extends AbstractMojo +{ + + /** + * @parameter expression="${project.build.directory}" + * @required + */ + private String outputDirectory; + + public void execute() + throws MojoExecutionException + { + getLog().info( "outputDirectory = " + outputDirectory ); + + File f = new File( outputDirectory ); + + if ( !f.exists() ) + { + f.mkdirs(); + } + + File touch = new File( f, "touch.txt" ); + + try + { + touch.createNewFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Error writing verification file.", e ); + } + } + +} diff --git a/maven-plugin-plugin/src/it/java-basic/verify.bsh b/maven-plugin-plugin/src/it/java-basic/verify.bsh new file mode 100644 index 0000000..ab9d249 --- /dev/null +++ b/maven-plugin-plugin/src/it/java-basic/verify.bsh @@ -0,0 +1,21 @@ +import java.io.*; +import java.util.*; +import java.util.regex.*; + +try +{ + File file = new File( basedir, "target/touch.txt" ); + System.out.println( "Checking for existence of generated touch file: " + file ); + if ( !file.isFile() ) + { + System.out.println( "FAILED!" ); + return false; + } +} +catch( Throwable t ) +{ + t.printStackTrace(); + return false; +} + +return true; diff --git a/maven-plugin-plugin/src/it/settings.xml b/maven-plugin-plugin/src/it/settings.xml new file mode 100644 index 0000000..68f23d0 --- /dev/null +++ b/maven-plugin-plugin/src/it/settings.xml @@ -0,0 +1,66 @@ + + + + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + apache.snapshots + Apache Snapshot Repository + http://people.apache.org/repo/m2-snapshot-repository + + false + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + +