Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gradle Command line Exec not working

Tags:

gradle

groovy

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(
    project.sourceSets.main.output.classesDir,
    project.sourceSets.main.resources,
    project.configurations.runtime
    ).getAsPath()

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?

like image 829
Rajmahendra Avatar asked Jan 01 '26 01:01

Rajmahendra


1 Answers

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"
like image 97
Peter Niederwieser Avatar answered Jan 03 '26 14:01

Peter Niederwieser



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!