War context root change is not reflected in WebSphere made through Maven and deployed using MyEclipse

Narendra Verma picture Narendra Verma · Oct 16, 2013 · Viewed 8.5k times · Source

I am using WebSphere 7 and trying to deploy war from MyEclipse (Server > WebSphere 7 > right click > Add Deployment).

I am using below maven war plug-in:

    <groupId>com.xxx.my.app</groupId>
    <artifactId>my-app</artifactId>
    <packaging>war</packaging>
    <name>my-app</name>

     <build>
            <finalName>my-app-context-root</finalName>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                </plugin>           
            </plugins>
        </build>

To change context root of my war I tried below options:

First option:

<properties>
    <m2eclipse.wtp.contextRoot>my-app-context-root</m2eclipse.wtp.contextRoot>      
</properties>

Second Option:

  <finalName>my-app-context-root</finalName>

But no Luck so for with these options. Whenever I deploy my application/war from MyEclipse and check context root in WebSphere server, WebSphere still shows the context root as 'my-app' (which is mentioned in name tag) not 'my-app-context-root'.

Answer

Vinay picture Vinay · Oct 31, 2013

One approach could be changing the war file [ my-app tag] to context root name. This way it will deploy the application with desired context root name.