Maven Surefire
  1. Maven Surefire
  2. SUREFIRE-727

Classpath too long on windows with useManifestOnlyJar=false

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.8.1
    • Fix Version/s: 2.9
    • Component/s: Maven Surefire Plugin
    • Labels:
      None
    • Complexity:
      Intermediate
    • Patch Submitted:
      Yes
    • Number of attachments :
      0

      Description

      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() );

        Activity

        Hide
        Kristian Rosenvold added a comment -

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

        Show
        Kristian Rosenvold added a comment - According to http://support.microsoft.com/?kbid=830473 , this solution should help for all but the most antique windows versions.
        Hide
        Kristian Rosenvold added a comment -

        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)

        Show
        Kristian Rosenvold added a comment - 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)

          People

          • Assignee:
            Kristian Rosenvold
            Reporter:
            kevin aloisi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: