Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8295

Groovyc ant task can overflow Windows command line if classpath is large

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.14
    • Ant integration
    • None
    • Windows

    Description

      The groovyc ant adapter tries to account for the 32K command line length limit on windows in its addSourceFiles method. However, if the command line gets long for other reasons – we include a number of libraries in our compiled projects – the command line can still be overflown.

      This results in:

      CompileAntScript.xml:129: Error running forked groovyc.
      	at org.codehaus.groovy.ant.Groovyc.runForked(Groovyc.java:1121)
      	at org.codehaus.groovy.ant.Groovyc.compile(Groovyc.java:1214)
      	at org.codehaus.groovy.ant.Groovyc.execute(Groovyc.java:831)
      
      Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.8.0_60\jre\bin\java": CreateProcess error=206, The filename or extension is too long
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
      	at java.lang.Runtime.exec(Runtime.java:620)
      	at org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:862)
      	at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:481)
      	at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:495)
      	at org.codehaus.groovy.ant.Groovyc.runForked(Groovyc.java:1119)
      	... 31 more
      Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long
      	at java.lang.ProcessImpl.create(Native Method)
      	at java.lang.ProcessImpl.<init>(ProcessImpl.java:386)
      	at java.lang.ProcessImpl.start(ProcessImpl.java:137)
      	at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
      	... 36 more
      

      Would it be possible to add command line length checking to runForked instead of addSourceFiles and use a command file for groovyc to prevent command line overflow? Without this, we are having to use a lot of verbose workarounds in Ant.

      https://github.com/apache/groovy/blob/master/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java

      Attachments

        1. Groovyc.patch
          3 kB
          Eric Milles

        Issue Links

          Activity

            People

              paulk Paul King
              emilles Eric Milles
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: