1. Start Here
    1. Welcome
    2. Download
    3. User Guide (PDF)
    4. What’s New
    5. Community Wiki
  2. Using Buildr
    1. Getting Started
    2. Projects
    3. Building
    4. Artifacts
    5. Packaging
    6. Testing
    7. Settings/Profiles
    8. Languages
    9. More Stuff
    10. Extending Buildr
    11. Recipes
  3. Reference
    1. API
    2. Rake
    3. Antwrap
    4. Troubleshooting
  4. Get Involved
    1. Mailing Lists
    2. Issues/Bugs
    3. Contributing
  5. Project Status
    1. License
    2. Changelog
    3. Specs
    4. Coverage
Google Custom Search


  1. Creating a classpath
  2. Keeping your Profiles.yaml file DRY
  3. Speeding JRuby
  4. Continuous Integration with Atlassian Bamboo

Commond recipes for Buildr, collected from the mailing list.

Creating a classpath

For Java, the classpath argument is simply a list of paths joined with an OS-specific path separator:

cp = paths.join(File::PATH_SEPARATOR)

This assumes paths points to files and/or directories, but what if you have a list of artifact specifications? You can turn those into file names in two steps. First, use artifacts to return a list of file tasks that point to the local repository:

tasks = Buildr.artifacts(specs)

Next, map that list of tasks into list of file names (essentially calling name on each task):

paths = tasks.map(&:name)

This works as long as the artifacts are already in your local repository, otherwise they can’t be found, but you can ask Buildr to download them by calling invoke on each of these tasks:

tasks = Buildr.artifacts(specs).each(&:invoke)

So let’s roll this all into a single line:

cp = Buildr.artifacts(specs).each(&:invoke).map(&:name).join(File::PATH_SEPARATOR)

Keeping your Profiles.yaml file DRY

YAML allows you to use anchors (&), similar to ID attributes in XML, and reference them later on (*). For example, if you have two profiles that are identical, you can tell YAML that one is an alias for the other:

development: &common
  db: oracle
  port: 8080
test: *common
production: *common

If you have two elements that are almost identical, you can merge the values of one element into another (<<), for example:

development: &common
  db: hsql
  jdbc: hsqldb:mem:devdb
  <<: *common
  jdbc: hsqldb:file:testdb

Speeding JRuby

When using JRuby you will notice that Buildr takes a few seconds to start up. To speed it up, we recommend switching to Java 1.6 and running the JVM in client mode:

$ export JAVA_OPTS=-client

Continuous Integration with Atlassian Bamboo

This recipe outlines how to configure a new Bamboo project to use Buildr. The following steps assume that you have logged-on to Bamboo as an Administrator.

1. Configure a Builder

2. Create a Plan

3. Trigger a Build

A build should occur automatically at the point of project creation. It can also be manually triggered at any time

The project page will contain full status information for previous builds and the results tabs will integrate the results from your JUnit tests.