IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 1 reply
  • Latest Post - ‏2013-03-08T09:37:11Z by Iain_Duncan
SystemAdmin
SystemAdmin
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
    Iain_Duncan
    23 Posts

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

    ‏2013-03-08T09:37:11Z  
    Hi,

    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:

    http://pic.dhe.ibm.com/infocenter/wasinfo/v8r5/index.jsp?topic=%2Fcom.ibm.websphere.wlp.iseries.doc%2Fae%2Ftwlp_setup_vars.html

    Hope that helps,
    Iain