int128 / gradle-ssh-plugin

Gradle SSH Plugin

Home Page:https://gradle-ssh-plugin.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lack of documentation for get

liemle3893 opened this issue · comments

Problem: get destination required absolute path instead of relative/projectDir.

I've got this problem when trying to get generated files from my server.
This link does not told about absolute path. So I end-up myself to use projectDir.getAbsolutePath();

Environment info

gradle-ssh-plugin-2.7.1 (groovy-ssh-2.7.1, jsch-0.1.53, groovy-2.4.11, java-1.8.0_111)

Steps to reproduce

  1. Create a submodule
  2. Create remote and get file from remote
  3. Build from root project.

settings.gradle:

include 'libs'
project(':libs').projectDir = new File('thrift')

build.gradle

compile project(":libs")

thirft/build.gradle

task genThriftJar {
    doLast {
        def projectLocaltion = projectDir.getAbsolutePath();
        ssh.run {
            session(remotes.compilerServer) {
                // Delete existing thrift file.
                cleanGeneratedFiles()
                put from: file("thrift/$serviceName" + ".thrift"), into: "$compilerLocation/$serviceName" + ".thrift"
                execute "mkdir -p $compilerLocation/gen-java"
                def compileResult = execute "bash $compilerLocation/genjar $serviceName", logging: 'stdout', pty: true
                assert compileResult.contains('SUCCESSFUL')
                get from: "$compilerLocation/$serviceName" + '.jar', into: "libs/"
            }
        }
    }
}

P/s: Sorry for my bad English.