o Extended IT plugin to allow distinction of multiple executions

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@992668 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2010-09-04 20:17:55 +00:00
parent 78debe8e47
commit 5e7d4e0821
5 changed files with 32 additions and 4 deletions

View File

@ -333,6 +333,12 @@ public abstract class AbstractDependencyMojo
if ( pathname != null )
{
if ( pathname.indexOf( "@idx@" ) >= 0 )
{
// helps to distinguished forked executions of the same mojo
pathname = pathname.replaceAll( "@idx@", String.valueOf( nextCounter() ) );
}
file = new File( pathname );
if ( !file.isAbsolute() )
@ -344,4 +350,19 @@ public abstract class AbstractDependencyMojo
return file;
}
private int nextCounter()
{
int counter = 0;
String key = getClass().getName();
synchronized ( System.class )
{
counter = Integer.getInteger( key, 0 ).intValue();
System.setProperty( key, Integer.toString( counter + 1 ) );
}
return counter;
}
}

View File

@ -23,7 +23,9 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Creates text files that list the dependencies with scope compile in the order returned from the Maven core.
* Creates text files that list the dependencies with scope compile in the order returned from the Maven core. The path
* parameters of this mojo support the token <code>&#64;idx&#64;</code> to dynamically insert a running index in order
* to distinguish multiple executions of the same mojo.
*
* @goal compile
* @requiresDependencyResolution compile

View File

@ -24,7 +24,8 @@ import org.apache.maven.plugin.MojoExecutionException;
/**
* Creates text files that list the dependencies with scope compile and runtime in the order returned from the Maven
* core.
* core. The path parameters of this mojo support the token <code>&#64;idx&#64;</code> to dynamically insert a running
* index in order to distinguish multiple executions of the same mojo.
*
* @goal compile-runtime
* @requiresDependencyResolution compile+runtime

View File

@ -23,7 +23,9 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Creates text files that list the dependencies with scope runtime in the order returned from the Maven core.
* Creates text files that list the dependencies with scope runtime in the order returned from the Maven core. The path
* parameters of this mojo support the token <code>&#64;idx&#64;</code> to dynamically insert a running index in order
* to distinguish multiple executions of the same mojo.
*
* @goal runtime
* @requiresDependencyResolution runtime

View File

@ -23,7 +23,9 @@ import org.apache.maven.artifact.DependencyResolutionRequiredException;
import org.apache.maven.plugin.MojoExecutionException;
/**
* Creates text files that list the dependencies with scope test in the order returned from the Maven core.
* Creates text files that list the dependencies with scope test in the order returned from the Maven core. The path
* parameters of this mojo support the token <code>&#64;idx&#64;</code> to dynamically insert a running index in order
* to distinguish multiple executions of the same mojo.
*
* @goal test
* @requiresDependencyResolution test