You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "kevin aloisi (JIRA)" <ji...@codehaus.org> on 2011/04/18 17:18:22 UTC

[jira] Created: (SUREFIRE-727) Classpath too long on windows with useManifestOnlyJar=false

Classpath too long on windows with useManifestOnlyJar=false
-----------------------------------------------------------

                 Key: SUREFIRE-727
                 URL: http://jira.codehaus.org/browse/SUREFIRE-727
             Project: Maven Surefire
          Issue Type: Bug
          Components: Maven Surefire Plugin
    Affects Versions: 2.8.1
            Reporter: kevin aloisi
            Priority: Critical



If the useMandifestOnlyJar=false, then then jnuit won't run on windows because the classpath is to long. The better way to fork a java process is to set the CLASSPATH env variable instead of passing it on the command line.

This patch fixes the issue.


Index: src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
===================================================================
--- src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(revision 1092789)
+++ src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(working copy)
@@ -221,13 +221,13 @@
         }
         else
         {
-            cli.createArg().setValue( "-classpath" );
-
-            cli.createArg().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) );
+//            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();
 
-            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() );


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SUREFIRE-727) Classpath too long on windows with useManifestOnlyJar=false

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-727?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold closed SUREFIRE-727.
---------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.8.2
         Assignee: Kristian Rosenvold

Thanks for the patch, applied in r1095173

(And we don't leave commented out code in our code-base, we have version control for that)

> Classpath too long on windows with useManifestOnlyJar=false
> -----------------------------------------------------------
>
>                 Key: SUREFIRE-727
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-727
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.8.1
>            Reporter: kevin aloisi
>            Assignee: Kristian Rosenvold
>            Priority: Critical
>             Fix For: 2.8.2
>
>
> If the useMandifestOnlyJar=false, then then jnuit won't run on windows because the classpath is to long. The better way to fork a java process is to set the CLASSPATH env variable instead of passing it on the command line.
> This patch fixes the issue.
> Index: src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
> ===================================================================
> --- src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(revision 1092789)
> +++ src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(working copy)
> @@ -221,13 +221,13 @@
>          }
>          else
>          {
> -            cli.createArg().setValue( "-classpath" );
> -
> -            cli.createArg().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) );
> +//            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();
>  
> -            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() );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (SUREFIRE-727) Classpath too long on windows with useManifestOnlyJar=false

Posted by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=263962#action_263962 ] 

Kristian Rosenvold commented on SUREFIRE-727:
---------------------------------------------

According to http://support.microsoft.com/?kbid=830473, this solution should help for all but the most antique windows versions.

> Classpath too long on windows with useManifestOnlyJar=false
> -----------------------------------------------------------
>
>                 Key: SUREFIRE-727
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-727
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.8.1
>            Reporter: kevin aloisi
>            Priority: Critical
>
> If the useMandifestOnlyJar=false, then then jnuit won't run on windows because the classpath is to long. The better way to fork a java process is to set the CLASSPATH env variable instead of passing it on the command line.
> This patch fixes the issue.
> Index: src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java
> ===================================================================
> --- src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(revision 1092789)
> +++ src/main/java/org/apache/maven/plugin/surefire/booterclient/ForkConfiguration.java	(working copy)
> @@ -221,13 +221,13 @@
>          }
>          else
>          {
> -            cli.createArg().setValue( "-classpath" );
> -
> -            cli.createArg().setValue( StringUtils.join( classPath.iterator(), File.pathSeparator ) );
> +//            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();
>  
> -            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() );

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira