I am switching our application for Capistrano deployment to Gradle .
Here requirement to make the script user interactive .
I am stuck to provide the user input in between task .
task('hello') << {
println "hello" }
task('copy', type: Copy) {
some_user_input = prompt("Are you sure to copy this file. ") ... // Here wants something like that
if(some_user_input==true){
from(file('srcDir'))
into(buildDir)
} }
I am searching for the solution of such issue . If you know about such way than please let me know .
Thanks in advance .
Gradle lets you use existing Ant tasks within your build script. You could use the [Ant input task][1] to achieve this:
ant.input(message: 'Are you sure to copy this file?', validargs: 'y,n', addproperty: 'doDeleteFile')
if(ant.doDeleteFile == 'y') {
// Call copy task
}
Note that unlike System.console()
this also works with the Gradle Daemon (tested on Linux).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With