【问题标题】:Resolve findBugs issue in gradle解决 gradle 中的 findBugs 问题
【发布时间】:2019-11-22 00:55:07
【问题描述】:

概述:

我正在尝试在我的项目中升级 Java 和 Gradle 版本,如下所示:

  • java从8到11
  • 从 5 级到 6 级

我的项目在旧版本上运行没有问题,但在 Java 11 和 Gradle 6 上运行时,它抱怨 fireBugs 插件并引发以下异常:

 > Plugin with id 'findbugs' not found.

gradle 文件片段:

buildscript {
    ext {
        SampleProjectVersion = '1.3.4'
    }
    repositories {
        mavenLocal()
        maven {
            url1
        }
    }
    dependencies {
        classpath(sample lib 1)
        classpath(sample lib 2)
    }

apply plugin: 'findbugs'

...

如果您能与我分享您的想法,我将不胜感激,因为我找不到任何合适的解决方案。

【问题讨论】:

  • 不知道是否有任何此类插件的确切 ID 为 findbugs,请参阅搜索 here。如果是自定义插件,请确保 the marker 也已发布。

标签: java gradle findbugs


【解决方案1】:

来自 Gradle 网站(将您的构建从 Gradle 5.x 升级到 6.0):

FindBugs 插件已被移除

已弃用的 FindBugs 插件已被删除。作为备选, 您可以使用 Gradle 插件门户中的 SpotBugs 插件。

https://docs.gradle.org/current/userguide/upgrading_version_5.html

【讨论】:

  • findbugs 支持到什么 gradle 版本?
【解决方案2】:

您可以使用 SpotBugs 插件。试试我的 gradle 文件的 sn-p

buildscript {
ext {
    SampleProjectVersion = '1.3.4'
}
repositories {
    mavenLocal()
    maven {
        url1
    }
}
dependencies {
    classpath(sample lib 1)
    classpath(sample lib 2)
    classpath "gradle.plugin.com.github.spotbugs:spotbugs-gradle-plugin:2.0.0"
}

apply plugin: "com.github.spotbugs"

tasks.withType(com.github.spotbugs.SpotBugsTask) {
    spotbugsMain.enabled = true
    spotbugsTest.enabled = true
    reports {
        xml.enabled = false
        html.enabled = true
    }
}
...

【讨论】:

    猜你喜欢
    • 2015-05-01
    • 2017-04-10
    • 1970-01-01
    • 1970-01-01
    • 2012-12-26
    • 2011-02-06
    • 1970-01-01
    • 2020-02-29
    • 1970-01-01
    相关资源
    最近更新 更多