I am generating an RPM using rpm-maven-plugin. I would like to specify the destination directory using the relevant run-time env variable. The problem is that the plugin evaluates the variable during compile time.
For example the ${JAVA_HOME}:
<mapping>
<directory>${JAVA_HOME}/ext</directory>
<sources>
<source>
<location>/home/user/run.sh</location>
</source>
</sources>
</mapping>
I want the directory in the RPM spec file to stay ${JAVA_HOME}/ext and only to be evaluated during RPM installation, i.e. run-time.
Accordind to this documentation each environment variable is available with
env.prefix. So you can use it like this:Note
There are two different properties which is different.
${env.JAVA_HOME}is an environment variable and it's may not be set.${java.home}is a predefined System Property which points to the Java installation folder.