From bb004bd928c900e028144bf8f3ad7a5307f0e45e Mon Sep 17 00:00:00 2001 From: Benjamin Bentmann Date: Tue, 11 Aug 2009 13:54:45 +0000 Subject: [PATCH] o Added IT plugin to test @requiresOnline git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@803123 13f79535-47bb-0310-9956-ffa450edef68 --- .../maven-it-plugin-online/pom.xml | 51 +++++++++++++ .../maven/plugins/coreit/TouchMojo.java | 71 +++++++++++++++++++ its/core-it-support/core-it-plugins/pom.xml | 1 + 3 files changed, 123 insertions(+) create mode 100644 its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml create mode 100644 its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugins/coreit/TouchMojo.java diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml b/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml new file mode 100644 index 0000000000..363b32add8 --- /dev/null +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-online/pom.xml @@ -0,0 +1,51 @@ + + + + + + 4.0.0 + + + maven-it-plugins + org.apache.maven.its.plugins + 2.1-SNAPSHOT + + + maven-it-plugin-online + maven-plugin + + Maven Integration Test Plugin :: Online + + A test plugin that requires online mode. + + 2009 + + + true + + + + + org.apache.maven + maven-plugin-api + 2.0 + + + diff --git a/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugins/coreit/TouchMojo.java b/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugins/coreit/TouchMojo.java new file mode 100644 index 0000000000..744784fc25 --- /dev/null +++ b/its/core-it-support/core-it-plugins/maven-it-plugin-online/src/main/java/org/apache/maven/plugins/coreit/TouchMojo.java @@ -0,0 +1,71 @@ +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; + +/** + * Creates an empty file with a user-specified name. NOTE: This mojo requires online mode. + * + * @goal touch + * @phase validate + * @requiresOnline true + * + * @author Benjamin Bentmann + */ +public class TouchMojo + extends AbstractMojo +{ + + /** + * The path to the output file. + * + * @parameter expression="${touch.outputFile}" default-value="target/touch.txt" + */ + private File outputFile; + + /** + * Runs this mojo. + * + * @throws MojoExecutionException If the output file could not be created. + */ + public void execute() + throws MojoExecutionException + { + getLog().info( "[MAVEN-CORE-IT-LOG] Creating output file: " + outputFile ); + + try + { + outputFile.getParentFile().mkdirs(); + outputFile.createNewFile(); + } + catch ( IOException e ) + { + throw new MojoExecutionException( "Output file could not be created: " + outputFile, e ); + } + + getLog().info( "[MAVEN-CORE-IT-LOG] Created output file: " + outputFile ); + } + +} diff --git a/its/core-it-support/core-it-plugins/pom.xml b/its/core-it-support/core-it-plugins/pom.xml index 52b6eb4c4c..b4a662ce45 100644 --- a/its/core-it-support/core-it-plugins/pom.xml +++ b/its/core-it-support/core-it-plugins/pom.xml @@ -45,6 +45,7 @@ under the License. maven-it-plugin-invalid-descriptor maven-it-plugin-log-file maven-it-plugin-no-project + maven-it-plugin-online maven-it-plugin-packaging maven-it-plugin-parameter-implementation maven-it-plugin-plugin-dependency