【发布时间】:2022-01-06 02:44:19
【问题描述】:
有没有办法在 build.gradle 中避免这种重复?
pluginManager.withPlugin('java-library') {
apply plugin: 'com.github.spotbugs'
spotbugs {
toolVersion = '4.5.2'
ignoreFailures = false
showStackTraces = true
showProgress = true
excludeFilter = rootProject.file(rootProject.ext.excludeFile)
effort = 'default'
reportLevel = 'default'
reportsDir = file("$buildDir/spotbugs")
maxHeapSize = '1g'
extraArgs = [ '-nested:false' ] // no jar or zips
}
在下面的某个地方: ...
pluginManager.withPlugin('application') {
apply plugin: 'com.github.spotbugs'
spotbugs {
toolVersion = '4.5.2'
ignoreFailures = false
showStackTraces = true
showProgress = true
excludeFilter = rootProject.file(rootProject.ext.excludeFile)
effort = 'default'
reportLevel = 'default'
reportsDir = file("$buildDir/spotbugs")
maxHeapSize = '1g'
extraArgs = [ '-nested:false' ] // no jar or zips
}
我只想将相同的配置放在一个地方。
【问题讨论】:
标签: java gradle plugins build configuration