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?

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

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