bump. Anyone wanna give this a shot?
On Thu, Mar 5, 2009 at 10:42 AM, Les Hazlewood <[email protected]> wrote:
> I'm trying to set up a mechanism that needs to interpolate chunks of XML
> (or multiple line values) depending on environment/profile.
>
> Currently I have a single web.xml.vm file shared via the remote-resources
> plugin between multiple war modules. The web.xml file is nearly identical
> between war modules, with some minor exceptions. I'm trying to filter
> in/out those exceptions as necessary. If I don't use remote-resources or
> maven filters, I'd be cutting-and-pasting a lot of identical config
> (definately want to avoid that).
>
> For example, in one war module, a servlet listener should be defined. In
> another war module, the exact same config exists, but that particular
> listener should not be defined at all. So, I need the ability to filter in
> chunks of XML and/or multiple lines of text - not just values from a
> .properties file.
>
> Here is how I tried it:
>
> I modified the web.xml.vm file to contain this line:
>
> ....
> ${additionalListeners}
> ....
>
> I tried defining a property in both web module pom.xml files:
>
> ==== moduleA pom.xml (needs the filter definition) ====
> ...
> <properties>
> ...
> <additionalListeners>
> <listener>
> <listener-class>some.pkg.class.ServletListener</listener-class>
> </listener>
> </additionalListeners>
> ...
> </properties>
>
> ==== moduleB pom.xml (should *not* have the filter definition ====
> ...
> <properties>
> ...
> <additionalListeners></additionalListeners>
> ...
> </properties>
>
> However, Maven didn't like the embedded XML inside the above
> <additionalListeners> definition. So, I tried to wrap the above XML chunk
> in CDATA tags, but it didn't work. After adding the CDATA tags, the
> rendered web.xml file contained the raw ${additionalListeners} line,
> without proper substitution.
>
> I am willing to not use the remote-resources plugin in favor of using
> filters directly, but can filters work with XML chunks and multi-line
> properties? I have a chunks of configuration text (multiple lines) that
> need to be shared across web modules. It would be _nasty_ to define those
> shared chunks in .properties files.
>
> Can anyone explain a solution or point me to where this is already
> documented (mailing list, etc)? My google searches haven't provided
> anything fruitful yet :/
>
> Thanks!
>
> Les
>