buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ander Juaristi <ajuari...@gmx.es>
Subject How to package multi-project project into single JAR
Date Fri, 10 Apr 2015 10:42:53 GMT
Hi,

I have a Java project in Eclipse for whom I generated a buildfile automatically using Buildr
itself.

The project is formed by sub-projects, and the layout is the following:

MyProject
|- main
    |- src
|- utils
    |- src
|- config
    |- src
|- logging
    |- src

When I run "buildr package" it correctly packages every subproject in the corresponding "target"
directory, and it finally generates a file MyProject-1.0.0.jar in the root, but that JAR is
empty: it only contains a manifest.

MyProject
|- main
    |- src
    |- target
       |- main-1.0.0.jar
|- utils
    |- src
    |- target
       |- utils-1.0.0.jar
|- config
    |- src
    |- target
       |- config-1.0.0.jar
|- logging
    |- src
    |- target
       |- logging-1.0.0.jar
|- MyProject-1.0.0.jar          <-- Only the manifest, no classes

What I'd like to know is how to merge all of the subprojects into the root JAR. As a last
resort I could of course extend the "package" task and extract-repackage all the subprojects
using Ruby language, but I feel this should be possible using Buildr's mechanisms.

My buildfile looks like this (relevant parts only):

require 'buildr/ide/eclipse'

define "MyProject" do

   # This wasn't in the beginning, I added it in the end
   # and it then generated the empty root package.
   package :jar

   define "utils" do
     package :jar
     compile.with dependencies
   end

   # All the other sub-projects look similar
end

-- 
Regards,
- AJ

Mime
View raw message