buildr-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ingo Schmidt" <>
Subject Re: Merging questions
Date Fri, 08 Feb 2008 08:30:06 GMT
Hi Victor!

> Could you try the following, downside: creates two wars for my_project, the normal one
and the complete merge with content from MY_TEMPLATE

> desc "My Project"
> define "my_project" do
>    define "my_war-war" do

           complete = package(:zip, :id => "#{id}-complete", :type => :war)
           artifacts(MY_TEMPLATE).each { |archive| complete.merge(archive) }
           # merge has the same semantics than Hash#merge, it overwrites old entries with
those on merge' argument
           complete.merge(package(:war)) # Finally, add the jsps, classes for this project
at the end.

>    end
> [...]
> end

Sorry for late answer.
Yes, this does work indeed, thanks. But it has another downside:
It breaks your EAR task. I cannot anymore simply write:

I would have to come up with some sort of tricks. So I have come up with another solution,
which also works, but I do not like it that much:

desc "My Project"
  define "my_project" do
    define "my_war-war" do
      # include from template artifact
      template = unzip(_("target/template")=>artifact(MY_TEMPLATE)).include("what_i_need/**")
      remove = FileList[_("src/main/webapp/**/*.*")].map { |fn| fn.gsub(_("src/main/webapp")+"/","")}
      remove.each do |file|

Again, it would be very nice, if the include/exclude function could take an Array/Hash as
argument. Or can they already do this and I simply don't know how?

I then tried the latest version of buildr with your changes concerning packaging EARs and
utility libs. You now implement "Mechanism 2" of the Java 2 Platform 1.4. It is still working
nicely, with the only drawback, that I am using Jrun4 and that only supports Platform 1.3.
And sure enough specification is different here, or at least unclear. JRun4 says about packaging
utility classes, see "Handling J2EE module dependencies" at
So any utility libs that are common for WARs in the EAR are referenced in EAR/META-INF/MANIFEST.MF,
like your previous version did (with your previous version, I had to disable the manifest
for each WAR)
What JRun4 does here is fine with Platform 1.3 specification. So is there any way to maybe
support both mechanisms?
a) Mechanism 2 as in Platform 1.4 Spec (like it is now)
b) JRun4 way (put utility classes in EAR manifest, but not in WAR's ones)

Anyway, thanks again for your help. I will now try to check out your other changes/patches
and see if I manage to create an EAR with expanded WARs :-)

Cheers, Ingo =;->

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message