Search code examples
javaapachebuildrbuild-tools

Apache Buildr - extract artifact to project root


I started using Apache builder for a project and I am surprised how little code I need to build my project. But after the first successes, a problem arose:

I have some required text files stored in a jar file which can be downloaded from a repository. I have included it in my buildfile as an artifact and can download an compile with it.

Now I want to extract the contents of the jar and place it in the root folder of my project. Is there a way that Apache Buildr can do this for me? Just adding it to the classpath is not sufficient.


Solution

  • I believe this is the example you are looking for, from http://buildr.apache.org/artifacts.html

    bean_jar = file('target/app/bean.jar'=>unzip('target/app'=>app_zip))   
    

    You can also directly call Buildr's Unzip, just don't forget the extract at the end.

    Unzip.new( 'path/to/extra/to' => 'file/to/unzip').extract