You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2008/03/28 00:01:44 UTC

svn commit: r642018 - in /maven/plugins/trunk/maven-patch-plugin/src: it/projects/path with spaces/ it/projects/path with spaces/src/ it/projects/path with spaces/src/main/ it/projects/path with spaces/src/main/patches/ main/java/org/apache/maven/plugi...

Author: bentmann
Date: Thu Mar 27 16:01:30 2008
New Revision: 642018

URL: http://svn.apache.org/viewvc?rev=642018&view=rev
Log:
[MPATCH-3] Path with space makes command line invocation fail

Added:
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt   (with props)
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml   (with props)
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch   (with props)
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch   (with props)
    maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh   (with props)
Modified:
    maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java

Added: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/it/projects/path%20with%20spaces/goals.txt?rev=642018&view=auto
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt (added)
+++ maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt Thu Mar 27 16:01:30 2008
@@ -0,0 +1,2 @@
+clean
+initialize

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/goals.txt
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/it/projects/path%20with%20spaces/pom.xml?rev=642018&view=auto
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml (added)
+++ maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml Thu Mar 27 16:01:30 2008
@@ -0,0 +1,79 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+      http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  
+  <parent>
+    <groupId>org.apache.maven.plugins.patch.it</groupId>
+    <artifactId>it-project-parent</artifactId>
+    <version>1</version>
+  </parent>
+  
+  <artifactId>path-with-spaces</artifactId>
+  <name>path-with-spaces</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-patch-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>apply-patch-0</id>
+            <phase>initialize</phase>
+            <configuration>
+              <targetDirectory>${basedir}</targetDirectory>
+              <patches>
+                <patch>first.patch</patch>
+              </patches>
+            </configuration>
+            <goals>
+              <goal>apply</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>apply-patch-1</id>
+            <phase>initialize</phase>
+            <configuration>
+              <targetDirectory>${basedir}</targetDirectory>
+              <originalFile>${basedir}/target/test.txt</originalFile>
+              <destFile>${basedir}/target/test2.txt</destFile>
+              <patches>
+                <patch>second.patch</patch>
+              </patches>
+            </configuration>
+            <goals>
+              <goal>apply</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/it/projects/path%20with%20spaces/src/main/patches/first.patch?rev=642018&view=auto
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch (added)
+++ maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch Thu Mar 27 16:01:30 2008
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+Index: target/test.txt
+===================================================================
+--- target/test.txt	(revision 0)
++++ target/test.txt	(revision 0)
+@@ -0,0 +1 @@
++This is a test.
+

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/first.patch
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/it/projects/path%20with%20spaces/src/main/patches/second.patch?rev=642018&view=auto
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch (added)
+++ maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch Thu Mar 27 16:01:30 2008
@@ -0,0 +1,26 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#
+Index: target/test.txt
+===================================================================
+--- target/test.txt	(revision 0)
++++ target/test.txt	(revision 0)
+@@ -1,1 +1,1 @@
+-This is a test.
++This is another test.
+

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/src/main/patches/second.patch
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/it/projects/path%20with%20spaces/verify.bsh?rev=642018&view=auto
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh (added)
+++ maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh Thu Mar 27 16:01:30 2008
@@ -0,0 +1,45 @@
+/*
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+      http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+
+import java.io.*;
+import java.util.*;
+
+try
+{
+    File testFile = new File( basedir, "target/test.txt" );
+    if ( !testFile.isFile() )
+    {
+        System.err.println( "Missing test file: " + testFile );
+        return false;
+    }
+
+    testFile = new File( basedir, "target/test2.txt" );
+    if ( !testFile.isFile() )
+    {
+        System.err.println( "Missing test file: " + testFile );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
+
+return true;

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-patch-plugin/src/it/projects/path with spaces/verify.bsh
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java?rev=642018&r1=642017&r2=642018&view=diff
==============================================================================
--- maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java (original)
+++ maven/plugins/trunk/maven-patch-plugin/src/main/java/org/apache/maven/plugin/patch/ApplyMojo.java Thu Mar 27 16:01:30 2008
@@ -558,34 +558,36 @@
 
         if ( originalFile != null )
         {
-            cli.createArg().setLine( originalFile.getAbsolutePath() );
+            cli.createArg().setFile( originalFile );
 
             if ( destFile != null )
             {
-                cli.createArg().setLine( "-o " + destFile.getAbsolutePath() );
+                cli.createArg().setValue( "-o" );
+                cli.createArg().setFile( destFile );
             }
 
-            cli.createArg().setLine( patchFile.getAbsolutePath() );
+            cli.createArg().setFile( patchFile );
         }
 
-        cli.createArg().setLine( "-p" + strip );
+        cli.createArg().setValue( "-p" + strip );
 
         if ( ignoreWhitespace )
         {
-            cli.createArg().setLine( "-l" );
+            cli.createArg().setValue( "-l" );
         }
 
         if ( reverse )
         {
-            cli.createArg().setLine( "-R" );
+            cli.createArg().setValue( "-R" );
         }
 
         if ( backups )
         {
-            cli.createArg().setLine( "-b" );
+            cli.createArg().setValue( "-b" );
         }
 
-        cli.createArg().setLine( " < " + patchFile.getAbsolutePath() );
+        cli.createArg().setValue( "<" );
+        cli.createArg().setFile( patchFile );
 
         return cli;
     }