I finally figured this out. Since ear extends from jar, you can just use the rename method which allows you to provide a different name for any included resource.
apply plugin: 'ear'
dependencies {
compile "company:file-war:+"
compile project(':MyWeb')
deploy project(path: ':MyWeb', configuration: 'archives')
deploy "company:file-war:+"
}
ear {
deploymentDescriptor {
webModule("MyWeb.war", "/")
webModule("MyNewName.war", "/context")
}
rename { f ->
if (f.contains('file-war')) {
return "MyNewName.war"
}
}
}