我是 gradle 和 sonar qube 的新手。我已经在本地安装了 sonarqube,但是如果主要问题的数量大于 50,我需要使 gradle 构建在本地失败。
/*
build.gradle:
Please note that this file should not be changed except for local build and deployments.
Glpdependencies.gradle and build.gradle will be overwritten from glp-core repo. However, they can be modified
for local testing purposes.
*/
buildscript {
ext {
springBootVersion = '2.0.4.RELEASE'
}
repositories {
mavenLocal()
maven { url "https://plugins.gradle.org/m2/" }
mavenCentral()
dependencies {
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
}
}
// These are gradle build dependencies and not application requirements
dependencies {
classpath 'de.undercouch.download:de.undercouch.download.gradle.plugin:3.4.3'
classpath "net.linguica.gradle:maven-settings-plugin:0.5"
classpath "com.diffplug.spotless:spotless-plugin-gradle:3.14.0"
classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}"
classpath "org.springframework.cloud:spring-cloud-contract-gradle-plugin:2.0.0.RELEASE"
//classpath 'io.spring.gradle:dependency-management-plugin:1.0.6.RELEASE'
}
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "org.sonarqube"
sonarqube {
properties {
property "sonar.projectKey", "sum"
property "sonar.buildbreaker.skip" , "false"
}
}
group = 'com.test.sonarqube.gradle'
apply from: 'glpdependencies.gradle'
apply from: 'version.gradle'
Below is my gradle.properties:
//org.gradle.java.home=C:\\Program Files\\Java\\jdk1.8.0_144.
systemProp.sonar.host.url=http://localhost:9000
systemProp.sonar.sourceEncoding=UTF-8
systemProp.sonar.forceAuthentication=true
如果我们需要在其他地方进行配置,请告诉我。因为这是一个 gradle 项目,所以我的本地系统中也安装了声纳 qube 服务器。我在声纳 qube 服务器中得到了问题的类型等,但如果主要问题的数量大于 50,我需要在本地失败构建。我尝试了很多东西,但即使我添加了属性属性“sonar.buildbreaker.skip”也没有奏效" , "false" 在 build.gradle 但它仍然无法正常工作