2017-02-22 15 views
1

私はgradleビルドファイルからカスタムgroovyプラグインを呼び出そうとしています。しかし、sshのクラスを解決する際にエラーが発生しています。以下はビルドファイル、カスタムGroovyプラグインの一部とエラーです。gradle.buildでsshクラスを解決できません

build.gradle

plugins { 
    id 'org.sonarqube' version '2.0.1' 
    id 'groovy' 
    id 'org.hidetake.ssh' version'2.7.0' 
} 

dependencies { 
    compile gradleApi() 
    compile localGroovy() 
} 

CustPlugin.groovy

package com.nielsen.gradle 

import org.slf4j.Logger 
import org.slf4j.LoggerFactory 

import java.text.SimpleDateFormat 

import org.gradle.api.Project 
import org.gradle.api.Plugin 
import org.gradle.api.GradleException 
import org.gradle.api.plugins.BasePlugin 
import org.gradle.api.tasks.bundling.Zip 

import org.hidetake.groovy.ssh.Ssh.* 
import org.hidetake.groovy.ssh.core.Service 

import com.nielsen.gradle.cmRegistry.CMRegistryPlugin 

エラー

C:\Users\528302\Documents\gradle_all\projectf1>gradle build 
:compileJava UP-TO-DATE 
:compileGroovy 
startup failed: 
C:\Users\528302\Documents\gradle_all\projectf1\src\main\groovy\com\nielsen\gradle\CustPlugin.groovy: 14: unable to resolve class org.hidetake.groovy.ssh.Ssh 
@ line 14, column 1. 
    import org.hidetake.groovy.ssh.Ssh 
^

C:\Users\528302\Documents\gradle_all\projectf1\src\main\groovy\com\nielsen\gradle\CustPlugin.groovy: 15: unable to resolve class org.hidetake.groovy.ssh.core.Service 

@ line 15, column 1. 
    import org.hidetake.groovy.ssh.core.Service 
^

C:\Users\528302\Documents\gradle_all\projectf1\src\main\groovy\com\nielsen\gradle\CustPlugin.groovy: 17: unable to resolve class com.nielsen.gradle.cmRegistry.CMRegi 
stryPlugin 
@ line 17, column 1. 
    import com.nielsen.gradle.cmRegistry.CMRegistryPlugin 
^

この...感謝を解決する助けてください。

答えて

1

あなたは2つのものを混ぜています。 plugins { }クロージャを使用すると、ビルドスクリプト自体の依存関係が追加されます。しかし、この場合、ビルドしているコードはビルドスクリプトではなく、ライブラリに依存しています。 *何:

はそうあなたが

plugins { 
    id 'org.sonarqube' version '2.0.1' 
    id 'groovy' 
    id 'org.hidetake.ssh' version'2.7.0' 
} 

dependencies { 
    compile gradleApi() 
    compile localGroovy() 
    compile group: 'org.hidetake', name: 'groovy-ssh', version: '2.8.0' 
} 
+0

おかげでマーティンを持つ終わる...私が試したが、私はfollwoingエラーを取得していますdependencies { }

compile group: 'org.hidetake', name: 'groovy-ssh', version: '2.8.0'

に以下を追加してくださいが間違っていた: 設定 ':compileClasspath'のすべての依存関係を解決できませんでした。 >リポジトリが定義されていないため、外部依存関係org.hidetake:groovy-ssh:1.1.6を解決できません。 必須: プロジェクト: – ghost0806

+0

バージョン2.8.0と同じ – ghost0806

+0

リポジトリ宣言がありません。 が 'リポジトリに追加{ mavenCentralを() }'へ ご –

関連する問題