Search code examples
gradlesonarqube

Sonarqube gradle analyzing project, task not found in root project


Analysing project with this command

.\gradlew sonarqube \   -Dsonar.host.url=http://my.url \   -Dsonar.login=login --stacktrace

Getting this error

org.gradle.execution.TaskSelectionException: Task '\' not found in root project 'JavaLint'

And here is my gradle file

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

apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'eclipse'
archivesBaseName = 'JavaLint'
version = '0.1-SNAPSHOT' 
mainClassName = 'Main'

repositories {
    mavenCentral()
}

jar {
    manifest {
        attributes 'Main-Class': 'com.test.Run'
    }
}

sourceSets {
    main {
        java {
            srcDirs 'src'
        }
    }
 }

dependencies {
    compile group: 'commons-io', name: 'commons-io', version: '2.6'
    compile group: 'commons-lang', name: 'commons-lang', version: '2.6'
    compile group: 'org.jsoup', name: 'jsoup', version: '1.11.2'
    compile group: 'junit', name: 'junit', version: '4.12'
    compile group: 'log4j', name: 'log4j', version: '1.2.16'
}

Stack trace stacktrace

I don't understand what am i supposed to do with it.


Solution

  • Use it like that in windows Terminal: .\gradlew sonarqube -Dsonar.host.url=http://my.url -Dsonar.login=login --stacktrace

    After that ,you will find the project already in the SonarQube server.