我试图通过Sonar的静态代码分析来获得一个简单的Gradle项目(由eclipse自动创建的项目),以便在我们的持续集成上运行.我们的CI服务器位于代理服务器后面,我必须通过内部Nexus服务器访问Gradle插件存储库.
正如所描述的userguide我已经添加了以下我settings.gradle
pluginRepositories {
maven {
url 'http://link.to.my.nexus'
}
gradlePluginPortal()
}
rootProject.name = 'GradleTestProject'
Run Code Online (Sandbox Code Playgroud)
我的build.gradle看起来像这样:
plugins {
id "org.sonarqube" version "2.0.1"
}
apply plugin: 'java'
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compile 'org.slf4j:slf4j-api:1.7.21'
testCompile 'junit:junit:4.12'
}
Run Code Online (Sandbox Code Playgroud)
当我在Jenkins上运行它时,我收到以下错误消息:
FAILURE: Build failed with an exception.
* Where:
Settings file '/opt/hudson/jobs/GradleTestProject/workspace/settings.gradle' line: 1
* What went wrong:
A problem occurred evaluating settings 'workspace'.
> Could not find method pluginRepositories() for arguments [settings_20tc2o9xuj82hi1fvpe4wvcvt$_run_closure1@52b56c40] on settings 'workspace'.
Run Code Online (Sandbox Code Playgroud)
我查看了网络上的其他示例.他们都像我描述的那样做.
顺便说一句:我正在使用Gradle 2.12