Skip to content

Instantly share code, notes, and snippets.

@chetan
Created May 29, 2013 21:13
Show Gist options
  • Save chetan/5673887 to your computer and use it in GitHub Desktop.
Save chetan/5673887 to your computer and use it in GitHub Desktop.
Buildr classpath helper
module BuildrClasspath
include Extension
first_time do
# Define task not specific to any projet.
desc 'Create classpath for passing to java command'
Project.local_task('classpath')
end
before_define do |project|
project.recursive_task 'classpath' do |task|
# called when the task is actually executed
# i.e., via
# $ buildr classpath
paths = []
project.compile.dependencies.each { |d| paths << d.to_s }
project.test.dependencies.each { |d| paths << d.to_s }
puts paths.sort.uniq.join(":")
end
end
end
class Buildr::Project
include BuildrClasspath
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment