Define contextroot inside WAR file

Mohamed Saligh picture Mohamed Saligh · Dec 13, 2011 · Viewed 17.5k times · Source

I have an automated deployment script to deploy multiple WAR files in WAS 7. So, I would like to define contextroot inside the WAR file itself. It should automatically set to " ... -contextroot xxxx ..." from the file.

How do I do that? I think, I need to add something with WEB-INF/ibm-web-bnd.xml. I dont know what to write in it.

Pls help, thanks.

Answer

Brett Kail picture Brett Kail · Dec 14, 2011

Create WEB-INF/ibm-web-ext.xml with these contents:

<web-ext
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns="http://websphere.ibm.com/xml/ns/javaee"
  xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-ext_1_0.xsd"
  version="1.0"
>
  <context-root uri="/TestProject"/>
</web-ext>