As far as I know this is not possible. Velocity is not powerful enough to do string manipulation, it's only a templating language.
Actually I am running into the same limitation. For this to work you would need to put a custom object into the Velocity context that parses the artifactId property and exposes the data to the template. Currently this is not possible. I've found several mails on the user list that mentioned similar requirements: a mechanism in the archetype plugin to hook in custom velocity context objects. Additionally I've found [1], where the same is mentioned and from which I conclude that such an addition to the archetype plugin would be welcome and possible. This mail describes the possibility of user defined hooks that get called while preparing the velocity context to enhance the velocity context. However I don't readily see how such a hook could be loaded. I assume such a hook would be packaged together with the archetype template archive. This archetype template archive is not a dependency on the maven classpath as far as I know. Of course, usually you can add extra dependencies when you configure a plugin in the pom. However, the archetype plugin is special in that normally when you use archetype:generate you will not have any pom yet. So it puzzles me how in [1] JvZ imagined this was going to work. Anyone have suggestions? 1. http://maven.40175.n5.nabble.com/Archetype-capabilities-limitations-td216158.html#a216159 On Thu, Jun 23, 2011 at 8:20 PM, Christian Schuhegger < [email protected]> wrote: > Hello list, > > I am writing a maven archetype and it would be useful to convert an > ${artifactId} (e.g. my.nice.little.project) into a path: > my/nice/little/project. > > If this is possible, could somebody please point me to the relevant > documentation? I did not find it via google. > > Many thanks, > -- > Christian Schuhegger > http://www.el-chef.de/ > > > ------------------------------**------------------------------**--------- > To unsubscribe, e-mail: > [email protected].**org<[email protected]> > For additional commands, e-mail: [email protected] > >
