Author: krosenvold
Date: Tue Apr 19 19:25:58 2011
New Revision: 1095173

URL: http://svn.apache.org/viewvc?rev=1095173&view=rev
Log:
[SUREFIRE-727] Classpath too long on windows with useManifestOnlyJar=false

Modified:
    
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
    
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
    
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm

Modified: 
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm?rev=1095173&r1=1095172&r2=1095173&view=diff
==============================================================================
--- 
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
 (original)
+++ 
maven/surefire/trunk/maven-failsafe-plugin/src/site/apt/examples/class-loading.apt.vm
 Tue Apr 19 19:25:58 2011
@@ -48,7 +48,13 @@ java -classpath foo.jar:bar.jar MyApp
  your command line, and therefore a limit on how long you can make your 
classpath. The limit is different
  on different versions of Windows; in some versions only a few hundred 
characters are allowed, in others
  a few thousand, but the limit can be pretty severe in either case.
- 
+
+ * Update for Surefire 2.8.2
+
+It turns out setting the CLASSPATH as an environment variable may remove most 
of the
+practical length limitations, as documented in 
http://jira.codehaus.org/browse/SUREFIRE-727. This means
+most of the length-related problems in this article may be outdated.
+
 * How do people solve this problem in general?
 
  There are two "tricks" you can use to workaround this problem; both of them 
are can cause other problems in some cases.

Modified: 
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java?rev=1095173&r1=1095172&r2=1095173&view=diff
==============================================================================
--- 
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
 (original)
+++ 
maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
 Tue Apr 19 19:25:58 2011
@@ -19,15 +19,6 @@ package org.apache.maven.plugin.surefire
  * under the License.
  */
 
-import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
-import org.apache.maven.surefire.booter.Classpath;
-import org.apache.maven.surefire.booter.ForkedBooter;
-import org.apache.maven.surefire.booter.SurefireBooterForkException;
-import org.apache.maven.surefire.util.Relocator;
-import org.apache.maven.surefire.util.UrlUtils;
-import org.codehaus.plexus.util.StringUtils;
-import org.codehaus.plexus.util.cli.Commandline;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -39,6 +30,14 @@ import java.util.Properties;
 import java.util.jar.JarEntry;
 import java.util.jar.JarOutputStream;
 import java.util.jar.Manifest;
+import org.apache.maven.surefire.booter.ClassLoaderConfiguration;
+import org.apache.maven.surefire.booter.Classpath;
+import org.apache.maven.surefire.booter.ForkedBooter;
+import org.apache.maven.surefire.booter.SurefireBooterForkException;
+import org.apache.maven.surefire.util.Relocator;
+import org.apache.maven.surefire.util.UrlUtils;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.cli.Commandline;
 
 /**
  * Configuration for forking tests.
@@ -160,7 +159,7 @@ public class ForkConfiguration
     /**
      * @param classPath              cla the classpath arguments
      * @param classpathConfiguration the classpath configuration
-     * @param shadefire true if running shadefire
+     * @param shadefire              true if running shadefire
      * @return A commandline
      * @throws org.apache.maven.surefire.booter.SurefireBooterForkException
      *          when unable to perform the fork
@@ -221,13 +220,11 @@ public class ForkConfiguration
         }
         else
         {
-            cli.createArg().setValue( "-classpath" );
-
-            cli.createArg().setValue( StringUtils.join( classPath.iterator(), 
File.pathSeparator ) );
+            cli.addEnvironment( "CLASSPATH", StringUtils.join( 
classPath.iterator(), File.pathSeparator ) );
 
             final String forkedBooter = ForkedBooter.class.getName();
 
-            cli.createArg().setValue( shadefire ? new Relocator( ).relocate( 
forkedBooter ) : forkedBooter);
+            cli.createArg().setValue( shadefire ? new Relocator().relocate( 
forkedBooter ) : forkedBooter );
         }
 
         cli.setWorkingDirectory( workingDirectory.getAbsolutePath() );

Modified: 
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
URL: 
http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm?rev=1095173&r1=1095172&r2=1095173&view=diff
==============================================================================
--- 
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
 (original)
+++ 
maven/surefire/trunk/maven-surefire-plugin/src/site/apt/examples/class-loading.apt.vm
 Tue Apr 19 19:25:58 2011
@@ -47,6 +47,13 @@ java -classpath foo.jar:bar.jar MyApp
  your command line, and therefore a limit on how long you can make your 
classpath. The limit is different
  on different versions of Windows; in some versions only a few hundred 
characters are allowed, in others
  a few thousand, but the limit can be pretty severe in either case.
+
+* Update for Surefire 2.8.2
+
+It turns out setting the CLASSPATH as an environment variable may remove most 
of the
+practical length limitations, as documented in 
http://jira.codehaus.org/browse/SUREFIRE-727. This means
+most of the length-related problems in this article may be outdated.
+
  
 * How do people solve this problem in general?
 


Reply via email to