I want to pass parameters to file in archetype-resources>src>main folder.
So I declared required property in archetype-metadata.xml as
<requiredProperties>
<requiredProperty key="myParam">
<defaultValue>default-value</defaultValue>
</requiredProperty>
</requiredProperties>
and used ${myParam} in prototype file, but its value is not replaced. Why?
If I use custom value in pom.xml of prototype project then resulting project replaces value of ${myParam} with myValue. It works fine but same does not work for file in prototype folder. why?
You need to tell the Velocity engine that your file should be used as Velocity templates (so that it will actually replace any properties that it finds in the file). You do this by extending your
archetype-metadata.xmlfile and defining afileSet.I’m not sure of your exact folder structure and what the name of the file in question is, but something along these lines should work:
Basically the above is telling it to include all files under the
src/mainand the important part isfiltered=truewhich will cause all properties to be replaced.