This pull request is intended to show a possible extension for maven-archetype. I would be happy to become at least some feed back about utility of such a feature and chances to see this (or something similar) in maven-archetype in future.
I extended maven-achretype to allow some scripting while generating a new project from an archetype. I did'nt used the approch of an other templating engine (as suggested by issue ARCHETYPE-155), but simply added a scripting step after properties where configures. This allows to manipulate existing properties, create new ones or simply validate them.
Concretely I extended the archetype-metadata.xml descriptor like this:
First of all definition of scripts to execute after properties and before generation will start:
<script name="ComputePackage" file="scripts/compute-package.groovy" language="groovy" />
Attribute on existing requiredProperty element to specify that a property will be computed by scripting:
Script itself is a groovy script (may be extended to other languges) that has two read/write implicit variables:
Feedback welcome. Hope this may help you to improve maven-archetype in future.
first implementation of scripting support (using groovy scripts)