• 1 reply
  • Latest Post - ‏2013-03-08T09:37:11Z by Iain_Duncan
590 Posts

Pinned topic Using variables for path in Liberty App.ear.xml files

‏2013-03-07T18:52:34Z |
In my App.ear.xml files in wlp/usr/shared/apps, the sourceOnDisk does not appear to support using variables to define the file paths.

I have tried defining global environmental variables in Windows and using them in the file:
<file sourceOnDisk="%M2_REPO%\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar"

And I also tried String substitution option in RAD. The application file then appears as:
<file sourceOnDisk="${M2_REPO}\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar"

In both cases, the referred to libraries fail to load.

Does anyone know of a way to use variables for the path names in the App.ear.xml files for Liberty?
  • Iain_Duncan
    23 Posts

    Re: Using variables for path in Liberty App.ear.xml files


    I think to do what you want to do (i.e. use a Windows environment variable) you will need to set a Liberty variable to the windows variable which you will need to do when you launch the server:

    java -DrepoHome=%M2_REPO% -jar ws-launch.jar myServer

    This will have set the "repoHome" Liberty variable to the %M2_REPO% windows variable and make it available for so you can then use the String substitution that you were trying in RAD to produce:

    <file sourceOnDisk="${repoHome}\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar"

    You can read more about variable substitution here:

    Hope that helps,