diff options
author | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@yahoo-inc.com> | 2016-06-15 23:09:44 +0200 |
commit | 72231250ed81e10d66bfe70701e64fa5fe50f712 (patch) | |
tree | 2728bba1131a6f6e5bdf95afec7d7ff9358dac50 /lifecycle_mapping |
Publish
Diffstat (limited to 'lifecycle_mapping')
-rw-r--r-- | lifecycle_mapping/.gitignore | 2 | ||||
-rw-r--r-- | lifecycle_mapping/OWNERS | 1 | ||||
-rw-r--r-- | lifecycle_mapping/pom.xml | 54 | ||||
-rw-r--r-- | lifecycle_mapping/src/main/java/org/eclipse/m2e/MyMojo.java | 76 |
4 files changed, 133 insertions, 0 deletions
diff --git a/lifecycle_mapping/.gitignore b/lifecycle_mapping/.gitignore new file mode 100644 index 00000000000..0b832b112c9 --- /dev/null +++ b/lifecycle_mapping/.gitignore @@ -0,0 +1,2 @@ +/target +pom.xml.build diff --git a/lifecycle_mapping/OWNERS b/lifecycle_mapping/OWNERS new file mode 100644 index 00000000000..3b2ba1ede81 --- /dev/null +++ b/lifecycle_mapping/OWNERS @@ -0,0 +1 @@ +gjoranv diff --git a/lifecycle_mapping/pom.xml b/lifecycle_mapping/pom.xml new file mode 100644 index 00000000000..8c9d798edd2 --- /dev/null +++ b/lifecycle_mapping/pom.xml @@ -0,0 +1,54 @@ +<!-- Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <packaging>maven-plugin</packaging> + <version>1.0.0</version> + <name>${project.artifactId}</name> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>3.1.1</version> + </dependency> + <dependency> + <groupId>org.apache.maven.plugin-tools</groupId> + <artifactId>maven-plugin-annotations</artifactId> + <version>3.2</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-plugin-plugin</artifactId> + <version>3.3</version> + <configuration> + <!-- see http://jira.codehaus.org/browse/MNG-5346 --> + <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> + </configuration> + <executions> + <execution> + <id>mojo-descriptor</id> + <goals> + <goal>descriptor</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> +</project> diff --git a/lifecycle_mapping/src/main/java/org/eclipse/m2e/MyMojo.java b/lifecycle_mapping/src/main/java/org/eclipse/m2e/MyMojo.java new file mode 100644 index 00000000000..443dd45ce01 --- /dev/null +++ b/lifecycle_mapping/src/main/java/org/eclipse/m2e/MyMojo.java @@ -0,0 +1,76 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package org.eclipse.m2e; + +/* + * 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 org.apache.maven.plugins.annotations.LifecyclePhase; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; + +/** + * Goal which touches a timestamp file. + */ +@Mojo(name = "touch", defaultPhase = LifecyclePhase.PROCESS_SOURCES) +public class MyMojo extends AbstractMojo { + @Parameter(defaultValue = "${project.build.directory}", required = true) + 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 + } + } + } + } +} |