Gradle exec mvn dependency:copy-dependencies

(matthew.lowe2) #1


I’m having troubles with executing command ‘mvn dependency:copy-dependencies’ from Gradle via Exec task:

task copyDeps(type: Exec) << {
    commandLine 'mvn', 'dependency:copy-dependencies'

if I run this via cmdline: gradle copyDeps, nothing happens. I’m not sure what is exactly wrong. I’ve even tried to execute it like this

commandLine 'cmd', '/c', 'mvn', 'dependency:copy-dependencies'

… but it didn’t help at all. Can anyone give me some hint what is wrong with this code, or how can I enable as much logging as possible to reveal what went wrong (–debug is not enough).

Thanks in advance.

(Peter Niederwieser) #2

You have to remove the ‘<<’ (configuration vs. execution phase).

(matthew.lowe2) #3

Thx for lighting-fast answer :).

I figured it out in meantime however. I was running this task from parent project and I was wondering, why it didn’t execute in sub-project (but that’s different issue still to be solved :)).

When I run mentioned command from correct directory, it passed and copied all dependencies as required :).


commandLine 'mvn', 'dependency:copy-dependencies'
   results in "execCommand == null!"
commandLine 'cmd', '/c', 'mvn', 'dependency:copy-dependencies'
   use for Windows

Thx Peter !

(matthew.lowe2) #4

btw, can you help me how can I mark question answered? Or reffer me to some manual?

(René Groeschke) #5

BTW. we adressed this problem and will give a decent warning in upcoming gradle versions.

cheers, René

(Peter Niederwieser) #6

Unfortunately, only admins can mark a question as answered, and I’ve done it for you.