FindBugs plugin runs into command line length limit on Windows

Similar to the mailing list thread at http://gradle.1045684.n5.nabble.com/Groovyc-fork-failing-on-Windows-td3357060.html – I’m unable to run the findbugs task on my code due to this error in JDK 1.7:

[ant:findbugs] java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.7.0_02\jre\bin\java.exe": CreateProcess error=206, The filename or extension is too long

Or, with JDK 1.6:

[ant:findbugs] java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.6.0_21\jre\bin\java.exe": CreateProcess error=87, The parameter is incorrect

I’m using this version of gradle:

------------------------------------------------------------
Gradle 1.0-milestone-8
------------------------------------------------------------
  Gradle build time: Monday, February 13, 2012 11:53:32 PM UTC
Groovy: 1.8.4
Ant: Apache Ant(TM) version 1.8.2 compiled on December 20 2010
Ivy: 2.2.0
JVM: 1.6.0_21 (Sun Microsystems Inc. 17.0-b17)
OS: Windows 7 6.1 amd64

When I run gradle with --debug, I can extract the command it runs when it tries to start FindBugs in a new JVM. I’ve abbreviated it in two places below:

14:32:46.933 [DEBUG] [org.gradle.api.internal.project.ant.AntLoggingAdapter] Execute:Java13CommandLauncher: Executing 'C:\Program Files\Java\jdk1.6.0_21\jre\bin\java.exe' with arguments:
'-Dfindbugs.debug=true'
'-Dfindbugs.hostApp=FBAntTask'
'-classpath'
'C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\libs\third-party\findbugs-2.0.0.jar;C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\libs\third-party\findbugs-ant-2.0.0.jar'
'edu.umd.cs.findbugs.FindBugs2'
'-pluginList'
''
'-sortByClass'
'-timestampNow'
'-xml'
'-auxclasspathFromInput'
'-sourcepath'
(abbreviated from 120 files to 2)'C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\bridge\src\com\sri\pal\AbstractActionDef.java;C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\bridge\src\com\sri\pal\ActionDef.java'
'-outputFile'
'C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\bridge\build\reports\findbugs\main.xml'
'-exitcode'
(abbreviated from 166 files to 2)
'C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\bridge\build\classes\main\com\sri\pal\AbstractActionDef.class'
'C:\Users\chris\work\PAL-CPOF-SHELL\current\tasklearning\bridge\build\classes\main\com\sri\pal\ActionDef.class'

It seems likely that this command line is simply too long for Windows to handle.

I’ve created GRADLE-2167 for this.

Thanks for the report. Definitely a bug we need to fix.

I’m glad you’re on the case.

This issue was marked as fixed earlier today. Is the Fix Version known yet? Thanks.

This fix will be part of the next release (1.0-rc1) that will hopefully be available within the next two weeks. We’re currently working on a snapshot of this rc1 available to be tested in the field within the next days.