On Wed, Feb 24, 2010 at 8:37 AM, Will Rogers <[email protected]> wrote:
> Buildr's EAR packaging automatically generates an application.xml and
> includes it in the output's META-INF directory. I would like to do
> something similar to generate a geronimo-application.xml for inclusion
> in the EAR. I can handle the actual file generation part, but I'm not
> sure how/where to hook that into buildr's packaging.
>
> Where do I stick my code for generating and including a file in the
> EAR package so it works similar to the built-in application.xml
> generation?
>
Haven't looked into the code recently so this is mostly a high-level idea,
class GeronimoApplicationXml < Rake::FileTask
def initialize(*args) #:nodoc:
super
enhance do |task|
// do you stuff
File.open(task.name, "wb") { |file| file.write content }
end
end
...
end
class Buildr::Project
def geronimo_application_xml()
ear = package(:ear)
descriptor = GeronimoApplicationXml.define_task(project.path_to(:target,
...), ear)
ear.enhance [ descriptor ]
ear.enhance do |zip|
zip.include descriptor, :path => "..."
end
end
end
so in your projects where you need to generate the descriptor, you only need
to call geronimo_application_xml. Should be easy to turn into a plugin.
Hope this helps,
alex