How to exec a task with args

How can I write a simple exec task ? Example in documentation are too simple. I would like to be able to start mongodb on windows manually so I wrote this :

task startMongoDB(type:Exec) {

workingDir = ‘C:/Developer/mongodb-win32-x86_64-2.0.2/bin’

commandLine ‘mongod.exe’, ‘–dbpath’, ‘data/db’

}

but it doesnt’ work.

Is it the right syntax or should I use ‘cmd’ ?

Can you be more specific? What happens, and what’s the command line output? Does -s or -i provide more insight?

PS: Please enclose code snippets in ‘code’ tags.

Actually I’d expect an error because you are assigning a String to a File property. Simplest solution is to remove the ‘=’ after ‘workingDir’. Such things are documented in the DSL reference.

Actually it almost works now when I use the following lines :

task startMongoDB(type:Exec) {

commandLine ‘cmd’, ‘/c’, ‘C:/Developer/mongodb-win32-x86_64-2.0.2/bin/mongod.exe’, ‘–dbpath’, ‘data/db’

}

But the problem is once I have started startMongoDB, mongod is launched and take control of the console so after I cannot start another command to start jetty for instance How can I start it as a separate process ?

Ok I found

what is the solution?