views:

49

answers:

2

I use buildr for my build process.

My project setup:

Project A -> Project B Project A requires ant.jar

So, I want to create an output looking the following:

target/a.jar
target/lib/b.jar
target/lib/ant.jar

So far, I only managed to create a.jar inside target/ How can I persist the dependent jar files?

A: 

You can extend the package task to copy all the dependencies of Project A into target/lib like so,

ANT = 'org.apache.ant:ant:jar:1.8.1'

define 'my-project' do

  define 'A' do
    compile.with project('B'), ANT

    package.enhance do
      mkdir_p _(:target, :lib)
      compile.dependencies.each do |d|
        cp d.name, _(:target, :lib)
      end
    end
  end

  define 'B' do
    # ...
  end
end
Alex Boisvert
works great. Is enhance the best way to extend tasks? How does this work? I do not find anything about that method in the documentation of buildr
simonh
Yes, `enhance` is standard way to extend tasks. It comes from the Rake library, on which Buildr is based: http://rake.rubyforge.org/And more specifically you can look at: http://rake.rubyforge.org/files/doc/rakefile_rdoc.htmlWhen we publish the next version of Buildr (1.4.3), the website will be updated to reflect a merged version of Buildr's rdoc and Rake's rdoc so it will be easier to see inherited methods for all objects.
Alex Boisvert
A: 

@Alex How do I do artifact grouping in build.yaml

for example

I have proprietary jar and third party jars

How do I group them in build.yaml

artifacts: myjar: jar1 jar2 thirdpartyjar: jar3 jar4

Pls help

buildingagent