Search code examples
javamavenmaven-archetype

is there any way to generate value for nested variable while generating an project from maven archetype


Is there any way to generate value for nested variable while generating an project from maven archetype?

I have an statement like this in current archetype which I will replace when I generate an project out of it.

I will be making specailzed-folder a required property in archetype-metadata.xml

${specialized-folder}.tomcat.jdbc.user=xyz

tomcat-jdbc-user=${specialized-folder}.tomcat.jdbc.user

now let us say I need to get xyz into another file, I am doing this

<property name="username" value="${${tomcat-jdbc-user}" />

If specialize-folder is passed as company then

company.tomcat.jdbc.user=xyz

how can I get xyz in property name username?

Please let me know if there is other way around. Thanks.


Solution

  • I see instead of using ${${tomcat-jdbc-user}, we can use ${${specialized-folder}.tomcat.jdbc.user} and verified it's working fine.

    Thanks.