build.gradle - Isolated Gradle Tasks? -


i'm trying port on convoluted makefile gradle. need able have tasks execute in isolation of each other, cannot figure out how in gradle; example, if have build.gradle looks following:

apply plugin: 'eclipse' apply plugin: 'idea'  task foo {   println 'foo' }  task bar {   println 'bar' }  task baz {   println 'baz' } 

if run:

gradle -q foo

then expect see

foo

but instead see:

foobarbaz

printed terminal.

how can configure gradle perform single task?

you haven't given tasks functionality; you're seeing output of tasks being instantiated.

change build.gradle this...

task foo {   dolast {     println 'foo'   } }  task bar << {   println 'bar' }  task baz {   println 'baz' } 

and run foo task:

gradle foo

your output should be...

baz :foo foo 

...showing baz output when baz task created, foo task executed (":foo") followed output of foo task. note "<<" operator alias dolast.

see build script basics in gradle user guide.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -