Gradle-SSH插件拒绝连接

时间:2016-04-07 21:23:02

标签: gradle ssh build.gradle jsch

我正在尝试使用gradle-ssh-plugin与远程机器连接(详情请参阅:https://gradle-ssh-plugin.github.io/docs/#_run_the_script)。当我执行任务时,我收到以下错误:

引起:com.jcraft.jsch.JSchException:java.net.ConnectException:Connection 拒绝:连接

plugins {
    id 'org.hidetake.ssh' version '2.0.0'
    id 'java'
}

repositories {
        mavenCentral()
}

dependencies {
        compile 'org.hidetake:gradle-ssh-plugin:2.0.0'
        compile 'org.codehaus.groovy:groovy-backports-compat23:2.4.6'
}    
remotes {
        vesper01 {
            host = 'cpt-op-01-load1'
            user = 'CPT-OP\\admin'
            password = 'password'
        }
        vesper02 {
            host = 'cpt-op-01-load2'
            user = 'CPT-OP\\admin'
            password = 'password'
        }
        vesper03 {
            host = 'cpt-op-01-load3'
            user = 'CPT-OP\\admin'
            password = 'password'
        }
    }

    task install_dependencies_on_load_vms << {
        logger.info "Running Vesper on remote machine..."
        ssh.settings {
            knownHosts = allowAnyHosts
        }
        ssh.run {
            session(remotes.vesper01) {
                execute "C:/vesper_cpt/vespersetup.exe /S runas 5"
            }
        }
    }

有人能指出我正确的方向吗?

1 个答案:

答案 0 :(得分:1)

java.net.ConnectException: Connection refused: connect通常表示主机无法访问,或者您尝试访问的服务未运行。您确定在目标系统上运行了一个SSH守护程序并且它正在侦听您尝试连接的端口和接口吗?