o Extended goals to also dump the raw artifact collection

git-svn-id: https://svn.apache.org/repos/asf/maven/core-integration-testing/trunk@709766 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2008-11-01 20:00:34 +00:00
parent cbecc08c08
commit b5e6e0fa16
4 changed files with 38 additions and 3 deletions

View File

@ -29,8 +29,8 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**
* Provides common services for all mojos of this plugin.
@ -59,7 +59,7 @@ public abstract class AbstractDependencyMojo
* @param artifacts The list of artifacts to write to the file, may be <code>null</code>.
* @throws MojoExecutionException If the output file could not be written.
*/
protected void writeArtifacts( String pathname, List artifacts )
protected void writeArtifacts( String pathname, Collection artifacts )
throws MojoExecutionException
{
if ( pathname == null || pathname.length() <= 0 )
@ -90,6 +90,7 @@ public abstract class AbstractDependencyMojo
Artifact artifact = (Artifact) it.next();
writer.write( artifact.getId() );
writer.newLine();
getLog().info( "[MAVEN-CORE-IT-LOG] " + artifact.getId() );
}
}
}
@ -121,7 +122,7 @@ public abstract class AbstractDependencyMojo
* @param classPath The list of class path elements to write to the file, may be <code>null</code>.
* @throws MojoExecutionException If the output file could not be written.
*/
protected void writeClassPath( String pathname, List classPath )
protected void writeClassPath( String pathname, Collection classPath )
throws MojoExecutionException
{
if ( pathname == null || pathname.length() <= 0 )
@ -152,6 +153,7 @@ public abstract class AbstractDependencyMojo
Object element = it.next();
writer.write( element.toString() );
writer.newLine();
getLog().info( "[MAVEN-CORE-IT-LOG] " + element );
}
}
}

View File

@ -36,6 +36,16 @@ public class CompileMojo
extends AbstractDependencyMojo
{
/**
* The path to the output file for the project artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
* disk. Unlike the compile artifacts, the collection of project artifacts additionally contains those artifacts
* that do not contribute to the class path.
*
* @parameter expression="${depres.projectArtifacts}"
*/
private String projectArtifacts;
/**
* The path to the output file for the compile artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
@ -64,6 +74,7 @@ public class CompileMojo
{
try
{
writeArtifacts( projectArtifacts, project.getArtifacts() );
writeArtifacts( compileArtifacts, project.getCompileArtifacts() );
writeClassPath( compileClassPath, project.getCompileClasspathElements() );
}

View File

@ -36,6 +36,16 @@ public class RuntimeMojo
extends AbstractDependencyMojo
{
/**
* The path to the output file for the project artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
* disk. Unlike the runtime artifacts, the collection of project artifacts additionally contains those artifacts
* that do not contribute to the class path.
*
* @parameter expression="${depres.projectArtifacts}"
*/
private String projectArtifacts;
/**
* The path to the output file for the runtime artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
@ -64,6 +74,7 @@ public class RuntimeMojo
{
try
{
writeArtifacts( projectArtifacts, project.getArtifacts() );
writeArtifacts( runtimeArtifacts, project.getRuntimeArtifacts() );
writeClassPath( runtimeClassPath, project.getRuntimeClasspathElements() );
}

View File

@ -36,6 +36,16 @@ public class TestMojo
extends AbstractDependencyMojo
{
/**
* The path to the output file for the project artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
* disk. Unlike the test artifacts, the collection of project artifacts additionally contains those artifacts that
* do not contribute to the class path.
*
* @parameter expression="${depres.projectArtifacts}"
*/
private String projectArtifacts;
/**
* The path to the output file for the test artifacts, relative to the project base directory. Each line of this
* UTF-8 encoded file specifies an artifact identifier. If not specified, the artifact list will not be written to
@ -64,6 +74,7 @@ public class TestMojo
{
try
{
writeArtifacts( projectArtifacts, project.getArtifacts() );
writeArtifacts( testArtifacts, project.getTestArtifacts() );
writeClassPath( testClassPath, project.getTestClasspathElements() );
}