Hi All,

I was recently having some trouble with a # (hash) symbol in a filtered file
within a filtered file in my archetype and thought I'd share my solution for
feedback and hopefully to help any others with the same problem:

The following line in my spring applicationContext.xml:

        implementor="#${service-name-camelcase}Service"

for some reason was always resulting in:

        implementor="#theServiceName#ervice"

        (instead of implementor="#theServiceNameService")

I did a bit of debugging and noticed that velocity 1.4 is being used in the
archetype problem and after some googling came across
http://www.mail-archive.com/u...@velocity.apache.org/msg01877.html which
describes ways to avoid problems with the # symbol in velocity. I didn't
really want to declare any velocity symbols or macros inside an archetype
template file, however, I came up with the following solution:

1. Add a new requiredProperty to archetype-metadata.xml:

        <requiredProperties>
        <requiredProperty key="hashSymbol">
            <defaultValue>#</defaultValue>
        </requiredProperty>
        </requiredProperties>

2. Use this property wherever there are problems with the hash symbol, i.e
the first line above becomes:

        implementor="${hashSymbol}${service-name-camelcase}Service"

So far this seems to work correctly.

Hope this helps
Casey

p.s. Does anyone have any thoughts on this approach, and/or feels that this
requires a bug report against the archetype plugin?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to