3

I might be doing something wrong, cuz I'm using buildr for not so long, so all comments are welcome.

My project structure is:

define :proj do
    define :web do
        task :run do
            # runs the web part of the project in a jetty
        end
    end
end

now if I want to start my project I have to type

buildr proj:web:run

I'd like to type simply

buildr run

instead. How do I achieve that?

atamur
  • 1,567
  • 1
  • 14
  • 25

2 Answers2

5

At the top level of your buildfile (i.e., outside of any defines), add

task :run => 'proj:web:run'

This defines a task named run whose sole prerequisite is the proj:web:run task.

Rhett Sutphin
  • 1,045
  • 8
  • 15
3

You can also make the task a 'local task',

Project.local_task 'run'

which means that whenever you are inside the web directory, typing buildr run will look for a locally-scoped that of that name.

Note that Buildr 1.4.3 added a standard run task so you typically wouldn't need to make run a local task; see http://buildr.apache.org/more_stuff.html#run for details.

Alex Boisvert
  • 2,850
  • 2
  • 19
  • 18
  • NB that the `Project.local_task` invocation should be in the buildfile outside of the `define "project"...` block – ATG Jun 09 '15 at 10:57