Hi,

Since plexus-utils:1.4.2 is out, bump to it instead of snapshot.

Cheers,

Vincent

2007/5/20, [EMAIL PROTECTED] <[EMAIL PROTECTED]>:
Author: baerrach
Date: Sun May 20 05:00:32 2007
New Revision: 539869

URL: http://svn.apache.org/viewvc?view=rev&rev=539869
Log:
[MINVOKER-3] Applied patch (minor changes with formatting)
Upgraded to plexus-utils 1.4.2-SNAPSHOT
Added maven-artifact which was missing from pom
Fixed the FIXME's in MavenCommandLineBuilder around command line handling

Modified:
    maven/shared/trunk/maven-invoker/pom.xml
    
maven/shared/trunk/maven-invoker/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
    
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
    
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java

Modified: maven/shared/trunk/maven-invoker/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-invoker/pom.xml?view=diff&rev=539869&r1=539868&r2=539869
==============================================================================
--- maven/shared/trunk/maven-invoker/pom.xml (original)
+++ maven/shared/trunk/maven-invoker/pom.xml Sun May 20 05:00:32 2007
@@ -31,7 +31,12 @@
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
       <artifactId>plexus-utils</artifactId>
-      <version>1.4.1</version>
+      <version>1.4.2-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven</groupId>
+      <artifactId>maven-artifact</artifactId>
+      <version>2.0.5</version>
     </dependency>
     <dependency>
       <groupId>junit</groupId>

Modified: 
maven/shared/trunk/maven-invoker/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-invoker/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java?view=diff&rev=539869&r1=539868&r2=539869
==============================================================================
--- 
maven/shared/trunk/maven-invoker/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
 (original)
+++ 
maven/shared/trunk/maven-invoker/src/main/java/org/apache/maven/shared/invoker/MavenCommandLineBuilder.java
 Sun May 20 05:00:32 2007
@@ -92,8 +92,8 @@
                     + ". Using as-is.", e );
             }

-            // FIXME: Handle quotes in localRepo directory path...
-            cli.createArgument().setLine( "-s " + userSettingsFile.getPath() );
+            cli.createArg().setValue( "-s" );
+            cli.createArg().setValue( userSettingsFile.getPath() );
         }
     }

@@ -105,6 +105,7 @@
             try
             {
                 cli.addSystemEnvironment();
+                cli.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
             }
             catch ( IOException e )
             {
@@ -153,8 +154,7 @@
                 String key = (String) entry.getKey();
                 String value = (String) entry.getValue();

-                // FIXME: Handle funky key/value pairs that have spaces, 
newlines, etc.
-                cli.createArgument().setLine( "-D" + key + "=" + value );
+                cli.createArg().setValue( "-D" + key + "=" + value );
             }
         }
     }
@@ -281,8 +281,7 @@
                     + "\' is NOT a directory." );
             }

-            // FIXME: Handle quotes in localRepo directory path...
-            cli.createArgument().setLine( "-Dmaven.repo.local=" + 
localRepositoryDirectory.getPath() );
+            cli.createArg().setValue( "-Dmaven.repo.local=" + 
localRepositoryDirectory.getPath() );
         }
     }


Modified: 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java?view=diff&rev=539869&r1=539868&r2=539869
==============================================================================
--- 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
 (original)
+++ 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/DefaultInvokerTest.java
 Sun May 20 05:00:32 2007
@@ -5,6 +5,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Properties;

 import junit.framework.TestCase;

@@ -22,10 +23,14 @@

         Invoker invoker = new DefaultInvoker();
         invoker.setMavenHome( findMavenHome() );
-
+
+        Properties props = new Properties();
+        props.put( "key with spaces", "value with spaces" );
+
         InvocationRequest request = new DefaultInvocationRequest();
         request.setBaseDirectory( basedir );
-
+        request.setProperties( props );
+
         List goals = new ArrayList();
         goals.add( "clean" );
         goals.add( "package" );

Modified: 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java
URL: 
http://svn.apache.org/viewvc/maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java?view=diff&rev=539869&r1=539868&r2=539869
==============================================================================
--- 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java
 (original)
+++ 
maven/shared/trunk/maven-invoker/src/test/java/org/apache/maven/shared/invoker/MavenCommandLineBuilderTest.java
 Sun May 20 05:00:32 2007
@@ -698,6 +698,38 @@
         assertArgumentsPresent( Collections.singleton( "-Dkey=value" ), cli );
     }

+    public void testShouldSpecifyCustomPropertyWithSpacesInValueFromRequest()
+    throws IOException
+    {
+        logTestStart();
+
+        Commandline cli = new Commandline();
+
+        Properties properties = new Properties();
+        properties.setProperty( "key", "value with spaces" );
+
+        TestCommandLineBuilder tcb = new TestCommandLineBuilder();
+        tcb.setProperties( new DefaultInvocationRequest().setProperties( 
properties ), cli );
+
+        assertArgumentsPresent( Collections.singleton( "-Dkey=value with 
spaces" ), cli );
+    }
+
+    public void testShouldSpecifyCustomPropertyWithSpacesInKeyFromRequest()
+    throws IOException
+    {
+        logTestStart();
+
+        Commandline cli = new Commandline();
+
+        Properties properties = new Properties();
+        properties.setProperty( "key with spaces", "value with spaces" );
+
+        TestCommandLineBuilder tcb = new TestCommandLineBuilder();
+        tcb.setProperties( new DefaultInvocationRequest().setProperties( 
properties ), cli );
+
+        assertArgumentsPresent( Collections.singleton( "-Dkey with spaces=value 
with spaces" ), cli );
+    }
+
     public void testShouldSpecifySingleGoalFromRequest()
         throws IOException
     {
@@ -801,6 +833,44 @@
         assertEquals( projectDir.getCanonicalPath(), 
commandline.getWorkingDirectory().getCanonicalPath() );
     }

+    public void testShouldSetEnvVar_MAVEN_TERMINATE_CMD() throws Exception {
+        logTestStart();
+        File mavenDir = setupTempMavenHomeIfMissing();
+
+        InvocationRequest request = new DefaultInvocationRequest();
+
+        File tmpDir = getTempDir();
+        File projectDir = new File( tmpDir, 
"invoker-tests/maven-terminate-cmd-options-set" );
+
+        projectDir.mkdirs();
+        toDelete.add( projectDir.getParentFile() );
+
+        request.setBaseDirectory( projectDir );
+
+        createDummyFile( projectDir, "pom.xml" );
+
+        List goals = new ArrayList();
+
+        goals.add( "clean" );
+        request.setGoals( goals );
+
+        MavenCommandLineBuilder commandLineBuilder = new 
MavenCommandLineBuilder();
+
+        Commandline commandline = commandLineBuilder.build( request );
+
+        String[] environmentVariables = commandline.getEnvironmentVariables();
+        String envVarMavenTerminateCmd = null;
+        for ( int i = 0; i < environmentVariables.length; i++ )
+        {
+            String envVar = environmentVariables[i];
+            if (envVar.startsWith( "MAVEN_TERMINATE_CMD=" )) {
+                envVarMavenTerminateCmd = envVar;
+                break;
+            }
+        }
+        assertEquals( "MAVEN_TERMINATE_CMD=on", envVarMavenTerminateCmd);
+
+    }

     public void setUp()
     {




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to