Continuing the discussion from How to ftp a file? :
[quote=“Ray_Tayek, post:7, topic:9397, full:true”]
task checkWebServer << {
ssh.run {
put from: ‘build/libs/go2-0.2.jar’, into: ‘html/go/go2.jar’
}
}
}
works like a charm! … [/quote]
i have my password in plain text in the remotes closure.
is there a way to stick this in a separate groovy file near gradle.build?
or maybe ask for the password and get it from the command line?
thanks
One solution is to use a gradle.properties file for these types of things.
http://gradle.org/docs/current/userguide/build_environment.html
using a properties file in ~/.gradle seems to work (please see below) as the show properties tasks does print out the password. but trying to put the file fails with: “Auth fail”.
thanks
remotes {
web1 {
host = ‘tayek.com ’
user = ‘rtayek’
password=“$password”
}
}
task showPropertiesTask << {
println “password: $password”
}
You can use the gradle-credentials-plugin if you are concerned about the plain text nature of gradle.properties
.
i am not too concerned as the properties file is in my home directory.
but i will take a look at that plugin.
thanks
Ray_Tayek:
password=“$password”
so should the above work if the println "password: $password"
does?
or is there some trick to getting the value of password in the web1 closure?
thanks
In this case password
may very well be delegating to the property on the delegate of that closure. Try replacing it with project.property('password')
.
that works! (please see below)
thanks
remotes {
web1 {
host = 'tayek.com'
user = 'rtayek'
password=project.property('password')
}
}
how do i mark this thread answered?
thanks