[GRADLE-3168] sonar-runner plugin doesn't work on large projects due to invoking the Sonar Runner process with too long of a command line Created: 15/Sep/14  Updated: 18/Sep/14  Resolved: 18/Sep/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.2-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Luke Daley
Resolution: Fixed Votes: 0


I know you are in the process of fixing sonarRunner with Gradle 2.2 so this may be too early to report. I'm seeing the following when I do "gradlew sonarRunner" using gradle nightly 2.2-20140910134745+0000

at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:65)
... 1 more
Caused by: java.io.IOException: Cannot run program "C:\Program Files\Java\jdk1.7.0_67\bin\java.exe" (in directory "J:\git\gradledemo\access"): CreateProcess error=206, The filename or extension is too long
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 4 more
Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long

Full stacktrace here

I suspect it may not like like the space in "C:\Program Files"? I could always install java somewhere else, but I thought this would be worth fighting through since it is the default location Oracle specifies on setup.

This is my first attempt at using Sonar in quite some time so it is quite possible there is a configuration issue on my part as well. The relevant part of my build.gradle:

apply plugin: 'sonar-runner'
sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost:9000/"
property "sonar.jdbc.url", "jdbc:h2:tcp://localhost:9092/sonar"
property "sonar.jdbc.driverClassName", "org.h2.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"

[1] https://gist.github.com/bradthurber/c3fe4ba672d9c9ef7064

Comment by Gradle Forums [ 15/Sep/14 ]

Hi Brad,

These types of early reports are very useful. Thank you.

Is suspect that the actual command line invocation to start the process is too long for Windows.

Could you try moving your Gradle project to the root of C: drive, and also running with `-g c:/.gradle` temporarily. The goal here is to shorten the paths to see if this fixes the problem. If it does we know that's the problem.

Comment by Gradle Forums [ 15/Sep/14 ]

Hi Luke,

I moved my project to "C:\a" and ran with -g c:/.gradle.

C:\a>gradlew sonarRunner -g c:/.gradle

It is still failing as before.

I should have mentioned that I also tried setting JAVA_HOME to the DOS 'dir /x' short path JAVA_HOME=C:\Progra~1\Java\JDK17~1.0_6 but it still appears to be using the "long" java directory instead - as I still see "C:\Program Files\Java\jdk1.7.0_67\bin\java.exe" in the stacktrace.


Comment by Gradle Forums [ 15/Sep/14 ]

Can you please run with `--info` and provde the output. I need to see the full command that it's using to launch the runner.

Comment by Gradle Forums [ 15/Sep/14 ]

It looks like the runner command-line is an astounding ~200K long!

Output with --info is here
[1] https://dl.dropboxusercontent.com/u/46209058/output.log

Comment by René Gröschke (Inactive) [ 15/Sep/14 ]

This also happens on osx systems with error message:

Caused by: java.io.IOException: Cannot run program "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/java" (in directory "/Users/Rene/repos/gradle"): error=7, Argument list too long

Generated at Wed Jun 30 12:41:45 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.