Artifactory找不到SonarQube Gradle插件 [英] SonarQube Gradle Plugin is not found by Artifactory

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

问题描述

(此问题详细说明了问题I ,但有足够的差异,我认为这值得一个单独的问题)

(This question elaborates on a a question I asked earlier, but with enough differences that I think it warrants a separate question)

这篇文章关于Gradle论坛描述了类似的症状,但与我的问题并不完全相同.

This post on the Gradle forums describes similar symptoms, but not quite the same as my problem.

就像那里的海报一样,我得到了错误:

Like the poster there, I get the error:

未找到ID为'org.sonarqube'的插件.

Plugin with id 'org.sonarqube' not found.

当尝试在我的build.gradle文件中将SonarQube Gradle插件与以下内容一起使用时:

when trying to use the SonarQube Gradle plugin with the following in my build.gradle file:

buildscript {
  repositories {
    mavenLocal()
    maven { url 'http://[artifactory-url]:8081/artifactory/plugins-release/' }
  }
  dependencies {
    classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2")
  }
}

apply plugin: 'org.sonarqube'

他说他的Artifactory实例已经缓存了插件,而我的却没有.与他相似,我在公司防火墙后面,并且对Artifactory没有管理员权限,但是我可以看到plugins-release虚拟仓库确实包含了两个 http://jcenter.bintray.com .通常,只需从我们的Artifactory服务器请求一个库就可以立即找到并缓存该库,但是在这种情况下,它显然是失败的.

He says that his instance of Artifactory has cached the plugin, whereas mine hasn't. Similar to him, I'm behind a corporate firewall, and have no admin rights on Artifactory, but I can see that the plugins-release virtual repo does include both https://plugins.gradle.org/m2 and http://jcenter.bintray.com. Ordinarily, simply requesting a library from our Artifactory server makes it find and cache that library immediately, but in this case it is clearly failing.

当我删除apply plugin...行时,我看到以下错误:

When I remove the apply plugin... line, I see the following error:

   > Could not find org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2.
     Searched in the following locations:
     file:/C:/Users/[username]/.m2/repository/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.pom
     file:/C:/Users/[username]/.m2/repository/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.jar
     http://[artifactory-url]/artifactory/plugins-release/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.pom
     http://[artifactory-url]/artifactory/plugins-release/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.jar

因此,我相当确定Artifactory无法找到和缓存插件.如果我浏览到 https://plugins.gradle.org/m2/org/sonarsource/scanner ,它不包含"gradle"作为子目录.我不知道这是否相关,但这也许是造成Artifactory问题的原因吗?

So, I'm fairly sure that Artifactory is failing to find and cache the plugin. If I browse to https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.pom, I can get to the POM file, and the same for the JAR file, but I notice that if I browse to https://plugins.gradle.org/m2/org/sonarsource/scanner, it doesn't include 'gradle' as a subdirectory. I don't know if that's relevant, but perhaps that's the cause of the problem I'm seeing with Artifactory?

我不确定是否将其作为针对插件的错误来提出,或者是Artifactory问题,或者仅仅是我们这方面的某种错误配置.任何想法,不胜感激!

I'm not sure whether to raise this as a bug against the plugin, or if it's an Artifactory issue, or simply some kind of misconfiguration on our side. Any thoughts much appreciated!

由于@drorb,我从Artifactory获得了跟踪,并发现:

Thanks to @drorb I got a trace from Artifactory, and found:

2016-04-12T10:28:40.918 + 01:00执行HEAD请求到

2016-04-12T10:28:40.918+01:00 Executing HEAD request to https://plugins.gradle.org/m2/org/sonarsource/scanner/gradle/sonarqube-gradle-plugin/1.2/sonarqube-gradle-plugin-1.2.pom
2016-04-12T10:28:40.924+01:00 Received status {} (message: 501) on remote info request - returning unfound resource

501未实现,因此我认为这是在告诉我plugins.gradle.org存储库不支持HEAD请求,这似乎意味着Artifactory无法正确查询它.令我惊讶的是,它对其他人还是有用的-也许有些Artifactory配置可以更改为不执行HEAD请求?

501 is 'not implemented', so I assume this is telling me that the plugins.gradle.org repo doesn't support HEAD requests, which seems to mean Artifactory can't query it properly. I'm surprised that it works for others though - perhaps there's some Artifactory config I can get changed to not do the HEAD request?

进一步的挖掘使我意识到HEAD请求确实对我发出了正确的响应(303导致200),因此我认为问题是来自Artifactory服务器的连接.这似乎不值得添加答案,但是我将其保留在此处,以防它帮助其他遇到类似问题的人.

Further digging made me realise that the HEAD request does in fact give me a proper response (303 which leads to a 200), so I think the issue is connectivity from our Artifactory server. This doesn't seem worth adding as an answer, but I'll leave it here in case it helps someone else experiencing similar issues.

推荐答案

以下是我们的Gradle conf的片段,该片段可以正常工作:

Here is a snippet of our Gradle conf, which works:

buildscript {
    repositories {
        maven {
            url "http://[artifactory-url]:7980/artifactory/libs-release"
        }
    }
    dependencies {
        classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:1.2"
    }
}
apply plugin: 'org.sonarqube'

我能看到的唯一区别是,当您拥有/artifactory/plugins-release时,我们将/artifactory/libs-release放在了maven url中.也许您应该尝试指向libs-release,看看是否可行?

The only difference I can see is that we put /artifactory/libs-release in the maven url, while you have /artifactory/plugins-release. Perhaps you should try pointing to libs-release, and see if that works?

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

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