Plugin with id 'org.sonarqube' not found

后端 未结 2 522
既然无缘
既然无缘 2021-02-18 22:53

I am trying to implement sonar with gradle for code-coverage measure for my project. we are using gradle-4.0.1 and sonarqube-6.4 .

when I run gradle sonarqube from comm

相关标签:
2条回答
  • 2021-02-18 23:31

    In my case it looks like:

    plugins {
       id 'groovy'
       id 'application'
       id 'org.sonarqube' version '3.0'
    }
    
    repositories {
       mavenCentral()
    }
    
    sonarqube {
       properties {
          property "sonar.host.url", "http://sonarqube:9000"
          property "sonar.sources", "src"
       }
    }
    
    tasks['sonarqube'].dependsOn test
    
    0 讨论(0)
  • 2021-02-18 23:41

    Just like the 'org.springframework.boot' plugin, the 'org.sonarqube' plugin does not belong to Gradle. It is a third-party plugin, so you need to add it as a buildscript dependency:

    buildscript {
        ext {
            springBootVersion = '1.5.4.RELEASE'
        }
        repositories {
            mavenCentral()
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
            classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5"
        }
    }
    

    Now apply plugin: 'org.sonarqube' should work fine.

    0 讨论(0)
提交回复
热议问题