# Modify Context Root

**URL:** <https://discuss.gradle.org/t/modify-context-root/13288>\
**Category:** Help/Discuss\
**Created:** [December 16, 2015, 11:15pm UTC](https://discuss.gradle.org/t/modify-context-root/13288 "2015-12-16T23:15:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lukeplamann](https://avatars.discourse-cdn.com/v4/letter/l/90db22/32.png) [@lukeplamann](https://discuss.gradle.org/u/lukeplamann)\
**Post date:** [December 16, 2015, 11:15pm UTC](https://discuss.gradle.org/t/modify-context-root/13288/1 "2015-12-16T23:15:52Z")

</div>

I’m building an ear with an external dependency on a war. The build works and I can deploy the ear to my WebSphere server and have it work, but the war is at the wrong context. How do I modify the generated web-module’s context-root?

What I have:

```gradle
...
ear {
  baseName = 'myProjectEAR'

  deploymentDescriptor {
    webModule("myProject.war","/")
  }
}

dependencies {
  deploy group: "com.myCompany", name: "myProject", version: "0.1.3-SNAPSHOT", changing: true
}

...
```

This results in the following application.xml:

```gradle
<?xml version="1.0"?>
<application xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd" version="6">
  <module>
    <web>
      <web-uri>myProject.war</web-uri>
      <context-root>/</context-root>
    </web>
  </module>
  <module>
    <web>
      <web-uri>myProject-0.1.3-20151216.214129-5.war</web-uri>
      <context-root>myProject-0.1.3-20151216.214129-5</context-root>
    </web>
  </module>
  <library-directory>lib</library-directory>
</application>
```

Not the desired outcome. How do I change the context-root on the second module? I’m sure it’s something simple like correctly specifying the dependency or artifact in ear.deploymentDescriptor.webModule, but I cannot figure out how to do that.

---

<div class="post-metadata">

**Author:** ![subratanath123](https://avatars.discourse-cdn.com/v4/letter/s/3e96dc/32.png) [@subratanath123](https://discuss.gradle.org/u/subratanath123)\
**Post date:** [March 31, 2018, 10:04am UTC](https://discuss.gradle.org/t/modify-context-root/13288/2 "2018-03-31T10:04:12Z")

</div>

```
 ear {
      baseName = 'multi-module-project'

     deploymentDescriptor {
         webModule("admin-" + project(":admin").getVersion() + ".war", "/admin")
    }
 }

```

This works for the module where version name applied. cheers !!
