mirror of https://github.com/apache/maven.git
o Extended plugin to track execution of forking mojo
git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@808445 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d4d62f2940
commit
dd0a1b6d40
|
@ -23,6 +23,8 @@ import org.apache.maven.plugin.AbstractMojo;
|
|||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @goal fork
|
||||
*
|
||||
|
@ -41,9 +43,16 @@ public class ForkLifecycleMojo
|
|||
*/
|
||||
private MavenProject executedProject;
|
||||
|
||||
/**
|
||||
* @parameter default-value="${project.build.directory}"
|
||||
*/
|
||||
private File touchDirectory;
|
||||
|
||||
public void execute()
|
||||
throws MojoExecutionException
|
||||
{
|
||||
TouchMojo.touch( touchDirectory, "fork-lifecycle.txt", true );
|
||||
|
||||
if ( !executedProject.getBuild().getFinalName().equals( TouchMojo.FINAL_NAME ) )
|
||||
{
|
||||
throw new MojoExecutionException( "Unexpected result, final name of executed project is "
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.apache.maven.plugin.MojoExecutionException;
|
|||
import org.apache.maven.project.MavenProject;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -133,7 +134,13 @@ public class TouchMojo
|
|||
project.getBuild().setFinalName( FINAL_NAME );
|
||||
}
|
||||
|
||||
private static void touch( File dir, String file )
|
||||
static void touch( File dir, String file )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
touch( dir, file, false );
|
||||
}
|
||||
|
||||
static void touch( File dir, String file, boolean append )
|
||||
throws MojoExecutionException
|
||||
{
|
||||
try
|
||||
|
@ -145,9 +152,10 @@ public class TouchMojo
|
|||
|
||||
File touch = new File( dir, file );
|
||||
|
||||
FileWriter w = new FileWriter( touch );
|
||||
OutputStreamWriter w = new OutputStreamWriter( new FileOutputStream( touch, append ), "UTF-8" );
|
||||
|
||||
w.write( file );
|
||||
w.write( "\n" );
|
||||
|
||||
w.close();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue