我是 Gradle 新手,正在尝试为我的 Spring Boot 多模块项目配置 Spotbugs。
在我的父母 build.gradle 中,
buildscript {
dependencies {
classpath "org.springframework.boot:spring-boot-gradle-plugin:${versionSpringBoot}"
}
}
plugins {
id 'com.github.spotbugs' version '1.6.8'
}
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
}
subprojects {
apply plugin: 'java'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'pmd'
apply plugin: 'jacoco'
dependencyManagement {
imports {
}
}
configurations{
}
sourceCompatibility = '15'
targetCompatibility = '15'
dependencies {
}
pmd {
consoleOutput = true
toolVersion = "${versionPmd}"
sourceSets = [sourceSets.main]
ruleSets = ["category/java/errorprone.xml", "category/java/bestpractices.xml"]
}
spotbugs {
toolVersion = "${versionSpotBugs}"
sourceSets = [sourceSets.main]
}
jacoco {
toolVersion = "${versionJacoco}"
}
jacocoTestReport {
reports {
xml.enabled = true
}
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
}
Spotbugs 在运行时不运行
./gradlew 检查