新的 SonarQube Gradle 插件在哪里? [英] Where is the new SonarQube Gradle Plugin?

查看:43
本文介绍了新的 SonarQube Gradle 插件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近从以前版本的 Gradle 升级后,我开始收到警告说我应该使用官方 SonarQube 插件:

Having recently upgraded from a previous version of Gradle, I started getting a warning that I should use the official SonarQube plugin:

sonar-runner"插件已被弃用,并计划在 Gradle 3.0 中移除.请使用 SonarQube 的官方插件(文档).

The 'sonar-runner' plugin has been deprecated and is scheduled to be removed in Gradle 3.0. please use the official plugin from SonarQube (the docs).

通过该链接,我被定向到新插件的 Gradle 插件页面 (https://plugins.gradle.org/plugin/org.sonarqube),它告诉我使用:

From that link, I was directed to the Gradle Plugins page for the new plugin (https://plugins.gradle.org/plugin/org.sonarqube), which tells me to use:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"
  }
}

apply plugin: "org.sonarqube"

但这失败了.我在 Gradle 输出中看到的错误是:

But that fails. The error I'm seeing in my Gradle output is:

Could not GET 'https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.pom'.  
> peer not authenticated

当我尝试通过浏览器访问同一位置时,我得到一个 404,如果我从 https://plugins.gradle.org/m2/org,我可以到 https://jcenter.bintray.com/org/sonarsource/scanner/,但我看到的唯一子目录是'ant','cli'和'maven',没有'毕业典礼'.大概这是我问题的根本原因.

When I try to access the same location through a browser, I get a 404, and if I browse the file structure from https://plugins.gradle.org/m2/org, I can go as far as https://jcenter.bintray.com/org/sonarsource/scanner/, but the only subdirectories I see there are 'ant', 'cli' and 'maven', no 'gradle'. Presumably this is the root cause of my problem.

从这里的其他问题,我可以看到其他人正在使用该插件,所以大概它在某处可用,但我找不到它.有关工作来源的任何建议?

From other questions on here, I can see that others are using the plugin, so presumably it's available somewhere, but I can't find it. Any suggestions on a working source?

推荐答案

我们通过添加将插件导入Gradle

We got the plugin into Gradle by adding

类路径org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"

classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"

构建脚本依赖项.然后我们添加了

to buildscript dependencies. We then added

应用插件:'org.sonarqube'

apply plugin: 'org.sonarqube'

激活它.我们的本地 Artifactory 实例设置为代理 jCenter 和 mavenCentral.

to activate it. Our local Artifactory instance is set up to proxy jCenter and mavenCentral.

这篇关于新的 SonarQube Gradle 插件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆