MNG-2051 The SCM plugin which uses the scm manager works fine.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@512903 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason van Zyl 2007-02-28 19:02:06 +00:00
parent 053216ffe6
commit 967c2533b9
3 changed files with 65 additions and 12 deletions

View File

@ -32,12 +32,14 @@ A Note on Configuring Settings
* Plugin Groups * Plugin Groups
[]
If you are using the embedder it is entirely your responsibility to take user and global settings information and specify If you are using the embedder it is entirely your responsibility to take user and global settings information and specify
it in the embedder configuration. The embedder carries with it <<<no>>> defaults about where these are located and how it in the embedder configuration. The embedder carries with it <<<no>>> defaults about where these are located and how
they are used. If you want your embedded use of Maven to mimic the behavior of the Maven CLI insofar as settings use they are used. If you want your embedded use of Maven to mimic the behavior of the Maven CLI insofar as settings use
then use the following code: then use the following code:
%{snippet|id=mimic-cli|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderExampleTest.java} %{snippet|id=mimic-cli|url=http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderExampleTest.java}
Also note that the user and global settings are merged, and the user settings are dominant. Also note that the user and global settings are merged, and the user settings are dominant.

View File

@ -9,32 +9,46 @@ import java.io.File;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Properties;
public abstract class AbstractEmbedderExecutionTestCase public abstract class AbstractEmbedderExecutionTestCase
extends AbstractEmbedderTestCase extends AbstractEmbedderTestCase
{ {
protected MavenExecutionRequest request( File basedir,
List goals )
{
return new DefaultMavenExecutionRequest()
.setBaseDirectory( basedir )
.setGoals( goals );
}
protected File runWithProject( String goal ) protected File runWithProject( String goal )
throws Exception throws Exception
{ {
return runWithProject( new String[]{goal} ); return runWithProject( goal, null );
}
protected File runWithProject( String goal,
Properties properties )
throws Exception
{
return runWithProject( new String[]{goal}, properties );
} }
protected File runWithProject( String[] goals ) protected File runWithProject( String[] goals )
throws Exception throws Exception
{ {
return runWithProject( Arrays.asList( goals ) ); return runWithProject( goals, null );
}
protected File runWithProject( String[] goals,
Properties properties )
throws Exception
{
return runWithProject( Arrays.asList( goals ), properties );
} }
protected File runWithProject( List goals ) protected File runWithProject( List goals )
throws Exception throws Exception
{
return runWithProject( goals, null );
}
protected File runWithProject( List goals,
Properties properties )
throws Exception
{ {
/* /*
if ( request.getBaseDirectory() == null || !new File( request.getBaseDirectory() ).exists() ) if ( request.getBaseDirectory() == null || !new File( request.getBaseDirectory() ).exists() )
@ -49,7 +63,16 @@ public abstract class AbstractEmbedderExecutionTestCase
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory ); FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
MavenExecutionRequest request = request( targetDirectory, goals ); MavenExecutionRequest request = new DefaultMavenExecutionRequest()
.setBaseDirectory( targetDirectory )
.setGoals( goals );
System.out.println( "properties = " + properties );
if ( properties != null )
{
request.setProperties( properties );
}
MavenExecutionResult result = maven.execute( request ); MavenExecutionResult result = maven.execute( request );

View File

@ -0,0 +1,28 @@
package org.apache.maven.embedder;
import java.io.File;
import java.util.Properties;
/** @author Jason van Zyl */
public class EmbedderUsingScmPluginTest
extends AbstractEmbedderExecutionTestCase
{
protected String getId()
{
return "scm-plugin-from-embedder";
}
public void testRunningScmPlugin()
throws Exception
{
Properties p = new Properties();
File outputDirectory = new File( getBasedir(), "target/scm.diff" );
p.setProperty( "outputDirectory", outputDirectory.getCanonicalPath() );
p.setProperty( "connectionUrl", "scm:svn:http://svn.apache.org/repos/asf/maven/components/trunk/maven-embedder" );
File basedir = runWithProject( "scm:diff", p );
}
}