Error when running gradle command to analyze GitHub repository

Hello, I’m having trouble to analyze my github repo with Sonarqube. It is a Java project built with Gradle. I’m following the instructions provided by SonarQube as seen here:

This is what my build.gradle file looks like, I’m using gradle 4.6:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

plugins {
    id "org.sonarqube" version "2.6"
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

I get this error when running the first line of the command:

D:\projectdir>gradlew sonarqube \
Picked up _JAVA_OPTIONS: -Xmx512M

FAILURE: Build failed with an exception.

* What went wrong:
Task '\' not found in root project 'myprojectname'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to
get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3s

Any help is greatly appreciated.

Hi,

you are on Windows and the code snippet that you copy-paste works on Linux systems. I must admit that this is very misleading for Windows users, and we should do something about this.

All this to say, remove all the backslashes ( \ ) and line return so that you end up with a 1-line command. And this will work.

This was it, thank you very much!