Question

Is it possible, when referring to a property, to use another property's value in order to specify a property name ?

Example :
OS environment variables :
- WAS-USR-V1_HOME = a_path
- WAS-USR-V2_HOME = another_path

In my build, i want to use one of the two, letting the user choose between V1 or V2 by passing a property named "suffix" (-Dsuffix=V1 for example).

How can i do it in the POM ?
I'd like to set a property like :
<my.prop>${env.WAS-${env.USERNAME}-${suffix}_HOME}</my.prop>

Which must be intermediately evaluated to : ${env.WAS-USR-V1_HOME} ...
Finally ${my.prop} will be evaluated to a_path

Thank's !

Steve

Precisions :
- The user does NOT know the env variable name. He only knows the "suffix".
- Another part of the variable name is the "Username" set by OS
- The "my.prop" property needs to be generic (the same whatever username or suffix)

Était-ce utile?

La solution

This would require recursive resolution of properties and afaik it does NOT work.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top