Ivan Stanev
Ivan Stanev

Reputation: 130

Gradle not executing my task

I have a task that is supposed to run a shell script. In Gradle, I have defined the following:

defaultTasks 'renaming'
... some other stuff goes here ...
task renaming(type: Exec) {
    commandLine 'sh', 'src/main/bin/rename.sh'
}

I have the shell script under my module in src/main/bin/
However, it is not getting run (for test purposes, the shell creates a directory called "asfasf"). How can I fix this?

Upvotes: 0

Views: 446

Answers (1)

Vampire
Vampire

Reputation: 38734

As you give sh a relative path, it is resolved against the working directory of the Exec task. Either set the working directory for the Exec task or use file('src/main/bin/rename.sh') as second argument to commandLine.

Upvotes: 0

Related Questions