Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle cannot resolve dependencies for Sonar-Runner

I am trying to set up the Sonar-Runner with my existing gradle project. I am using Sonar-Runner 2.4 Gradle 2.2.1 and our Sonar server is 4.3.1. When I run gradle sonarRunner I get the following error:

Could not resolve all dependencies for configuration ':sonarRunner'. Cannot resolve external dependency org.codehaus.sonar.runner:sonar-runner-dist:2.4 because no repositories are defined.

I do have the artifact "org.codehaus.sonar.runner:sonar-runner-dist:2.4" in my nexus server that is set up in my build.gradle file. Does anyone have any intuition about this error? I have googled it extensively and been stuck on this for a couple of hours now.

My build.gradle for the sonar runner is very simple:

apply plugin: 'sonar-runner"
sonarRunner{
        toolVersion = '2.4'
                sonarProperties{
                        property "sonar.host.url", "$sonarHost"
                }
}
like image 780
Marco Corona Avatar asked Jan 05 '15 20:01

Marco Corona


1 Answers

It seems no repository is declared for the project you want to use with the sonar-runner plugin. You might have configured repositories for buildscript or for other projects only (in your multiproject build?)

To resolve the sonar-runner you need to configure a repository where it could be resolved from. You might have a coorporate repository in your company or you could use public ones like mavencentral or bintray. to declare for example the jcenter repository to resolve the sonar-runner. just add the following to your build script:

repositories {
    jcenter()
}
like image 144
Rene Groeschke Avatar answered Oct 26 '22 23:10

Rene Groeschke