mirror of https://github.com/apache/maven.git
Initial revision
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163607 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
df6e78a104
commit
a53bf28c86
|
@ -0,0 +1,9 @@
|
|||
target
|
||||
*~
|
||||
*.ipr
|
||||
*.iws
|
||||
*.iml
|
||||
*.log
|
||||
.classpath
|
||||
.project
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<model>
|
||||
<parent>
|
||||
<artifactId>maven-archetypes</artifactId>
|
||||
<groupId>maven</groupId>
|
||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>maven</groupId>
|
||||
<artifactId>maven-archetype-mojo</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.0-alpha-1-SNAPSHOT</version>
|
||||
</model>
|
|
@ -0,0 +1,6 @@
|
|||
<archetype>
|
||||
<id>plugin</id>
|
||||
<sources>
|
||||
<source>src/main/java/MyMojo.java</source>
|
||||
</sources>
|
||||
</archetype>
|
|
@ -0,0 +1,16 @@
|
|||
<model>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>${groupId}</groupId>
|
||||
<artifactId>${artifactId}</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${version}</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</model>
|
|
@ -0,0 +1,78 @@
|
|||
package $package;
|
||||
|
||||
import org.apache.maven.plugin.AbstractPlugin;
|
||||
import org.apache.maven.plugin.PluginExecutionRequest;
|
||||
import org.apache.maven.plugin.PluginExecutionResponse;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
|
||||
/**
|
||||
* @goal touch
|
||||
*
|
||||
* @phase process-sources
|
||||
*
|
||||
* @description Goal which cleans the build
|
||||
*
|
||||
* @parameter
|
||||
* name="outputDirectory"
|
||||
* type="String"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="#project.build.directory"
|
||||
* description=""
|
||||
*
|
||||
* @parameter
|
||||
* name="basedirAlignmentDirectory"
|
||||
* type="java.io.File"
|
||||
* required="true"
|
||||
* validator=""
|
||||
* expression="target/test-basedir-alignment"
|
||||
* description=""
|
||||
*/
|
||||
public class MyMojo
|
||||
extends AbstractPlugin
|
||||
{
|
||||
private static final int DELETE_RETRY_SLEEP_MILLIS = 10;
|
||||
|
||||
public void execute( PluginExecutionRequest request, PluginExecutionResponse response )
|
||||
throws Exception
|
||||
{
|
||||
String outputDirectory = (String) request.getParameter( "outputDirectory" );
|
||||
|
||||
File f = new File( outputDirectory );
|
||||
|
||||
if ( !f.exists() )
|
||||
{
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
File touch = new File( f, "touch.txt" );
|
||||
|
||||
FileWriter w = new FileWriter( touch );
|
||||
|
||||
w.write( "touch.txt" );
|
||||
|
||||
w.close();
|
||||
|
||||
// This parameter should be aligned to the basedir as the parameter type is specified
|
||||
// as java.io.File
|
||||
|
||||
String basedirAlignmentDirectory = (String) request.getParameter( "basedirAlignmentDirectory" );
|
||||
|
||||
f = new File( basedirAlignmentDirectory );
|
||||
|
||||
if ( !f.exists() )
|
||||
{
|
||||
f.mkdirs();
|
||||
}
|
||||
|
||||
touch = new File( f, "touch.txt" );
|
||||
|
||||
w = new FileWriter( touch );
|
||||
|
||||
w.write( "touch.txt" );
|
||||
|
||||
w.close();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue