Gradle Command line Exec not working

i am creating my own plugin when i try to create a task type Exec. Its not running any command. i am getting command line error stating command is not correct. I have displayed the generated command in Exec command to command prompt and when i run it works. The code is not wroking inside gradle plugin scope.

task myrun (type: Exec) {
    def cp = project.files(

String myCommand = "visage -cp ${cp} visage.javafx.scene.effect.EffectTest"

println "RUN COMMAND : ${myCommand}"
workingDir project.sourceSets.main.output.classesDir
// classpath project.files([project.sourceSets.main.output.classesDir,project.sourceSets.main.resources, project.configurations.runtime,])
commandLine = [myCommand]

Can anyone tell me is there any error in the code?


Here is the answer to the same post of yours in the Gradle forum:

commandLine is a list, and every argument becomes a separate element of that list:

commandLine "visage", "-cp", cp, "visage.javafx.scene.effect.EffectTest"

An alternative approach would be to use something like this

exec clause
executable = "bash"
args = [ "-c", """ "command arg1 arg2... argn" """]

Need Your Help

codeigniter cookie helper combined with session helper

php codeigniter cookies setcookie

Is it possible to run both session and cookie helpers? Cause I am trying and I can't get a cookie to set for the life of me, no matter what method I try either falling CI's docs to the letter and d...

How to convert a ruby hash object to JSON?

ruby-on-rails json ruby hashmap

How to convert a ruby hash object to JSON? So I am trying this example below & it doesn't work?