buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Boisvert <alex.boisv...@gmail.com>
Subject Re: How to package multi-project project into single JAR
Date Fri, 10 Apr 2015 14:54:15 GMT
Use the merge() method on package.

e.g.,

define "example" do
  define "a" do
    package(:jar)
  end

  define "b" do
    package(:jar)
  end


  package(:jar).merge project(:a), project(:b)
end


On Fri, Apr 10, 2015 at 3:42 AM, Ander Juaristi <ajuaristi@gmx.es> wrote:

> 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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message