You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Babu Naidu <pb...@gmail.com> on 2009/11/19 17:10:03 UTC

How to make a task default task

Hi,

I have a sub project with following definition.

    define "test-client" do
      compile.with
      package(:war).with
      package(:war).explode(:target => path_to("target/testClient"))
   end

to run explode task I would have to run buildr aproject:test-client:explode,
even when I cd to test-client directory. How do I make a change to this task
so that I can just say explode in test-client directory?

Thanks
Babu

Re: How to make a task default task

Posted by Alex Boisvert <al...@gmail.com>.
On Thu, Nov 19, 2009 at 8:10 AM, Babu Naidu <pb...@gmail.com> wrote:

> Hi,
>
> I have a sub project with following definition.
>
>    define "test-client" do
>      compile.with
>      package(:war).with
>      package(:war).explode(:target => path_to("target/testClient"))
>   end
>
> to run explode task I would have to run buildr
> aproject:test-client:explode,
> even when I cd to test-client directory. How do I make a change to this
> task
> so that I can just say explode in test-client directory?
>

Two ways,

1) Declare 'explode' to be a local task,

Project.local_task('explode')   # Put this at the top of your Buildfile

This allows you to just run "buildr explode" in the project directory.

2) Add the 'explode' task as a dependency on 'build' so it's run by default

build.enhance ['explode']  # Put this after package(:war).explode

And then a simple "buildr" command will run the explode task.

alex