2016-07-06 19 views
5

私は、Sonarによって行われた静的なコード解析を使って、簡単なGradleプロジェクト(eclipseによって自動的に作成されるプロジェクト)を取得しようとしています。私たちのCIサーバはプロキシの背後にあり、Gradleプラグインリポジトリに内部Nexusサーバ経由でアクセスする必要があります。pluginRepositoryのGradle Configuration

私のbuild.gradleはこのようになります

pluginRepositories { 
    maven { 
    url 'http://link.to.my.nexus' 
    } 
    gradlePluginPortal() 
} 

rootProject.name = 'GradleTestProject' 

私は私のsettings.gradleに以下を追加したuserguideで説明したように:

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' 
} 

私はジェンキンスでこれを実行すると、私が手次のエラーメッセージ:

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 [[email protected]] on settings 'workspace'. 

私はWebで他の例を見てきました。彼らはすべて私が説明したのと同じ方法でそれを行います。ところで

:私はGradleの2.12

+1

バージョンが低すぎるようですが、 '2.14'を試してみてください。 – Opal

答えて

0

を使用していますが、私は、バージョン4.0.1にいますよ。

私は同じエラーがありましたが、あなたの質問は答えなくて、やっと見つけてsettings.gradleでこれを試してみました。

pluginManagement { 
    repositories { 
     gradlePluginPortal() 

    } 
}