int128 / gradle-ssh-plugin

Gradle SSH Plugin
https://gradle-ssh-plugin.github.io
Apache License 2.0
319 stars 60 forks source link

Identity error deploy task fail to remote host #331

Closed peppe7119 closed 5 years ago

peppe7119 commented 5 years ago

Hi, this is my build.gradle:

repositories {
    jcenter()
    mavenLocal()
    mavenCentral()
}

dependencies { 
         ............................................
        'org.hidetake:gradle-ssh-plugin:2.10.1',
        ..............................................
}

apply plugin: "org.hidetake.ssh"

def config = new ConfigSlurper(env).parse(new File("$projectDir/deploy.config").toURI().toURL())

// ssh plugin
remotes {
    deployHost {
        host = config.server.host
        user = config.server.user
        identity = config.server.identity
        knownHosts = addHostKey(file("known_hosts"))
    }
}

And this my deploy.config file:

col {
        server {
            user = "xxx"
            identity = new File("C:\\xxx\\xxx\\mykey.pem")
            host = "xx.xx.xx.xx"
            vhost = "xxx.xxxx.xx"
        }
    }

I use eclipse (Version: 2019-03 (4.11.0) -Build id: 20190314-1200), when i try to launch task deploy on my remote server host from local, build failed with an exception.

And this is the error log:


* What went wrong:
Execution failed for task ':deployWar'.
> identity must be a File, String or null (deployHost[[:]:22]). Expression: (((settings.identity instanceof java.io.File) || (settings.identity instanceof java.lang.String)) || (settings.identity == null))

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

I check the path of the pem key and it is correct, i try to insert on deploy.config to identity this:

// content of the private key identity = """\ -----BEGIN RSA PRIVATE KEY----- BASE64ENCODEDKEY... ------END RSA PRIVATE KEY------- """.stripIndent()

but the error remain the same.

Any solution? I use an another version of eclipse on other pc (Version: 2018-09 (4.9.0) -Build id: 20180917-1800) with the same project and the deploy task run correctly.

peppe7119 commented 5 years ago

I found the issue.

The problem was with the versione of buildiship gradle, in particular with version starting from 2.2.2, with the version 2.2.1 no problem found.

I will inform the buildship comunity