I'm trying to use the same WebApp in different EAR-Files with different context roots.

Our WebApps contain quite some configuration (Servlets, ContextParameters, Mappings, etc.). We have to deploy them in various contexts, which differ slightly (mainly the context root). However, we do not want to duplicate them unnecessarily

The logic how WSAD handles the context roots is unfortunately not very suitable, because it insists that the context root declared in the Web Application Project is the same as in the Enterprise Application Project.

Even worse, we would like to automatize the deployment with ant scripts that configure some parameters in the web.xml and application.xml, and try to create the ear-files with projectBuild and earExport. These scripts do not work properly, because

1. WSAD cannot be made aware by ant facilities that configuration files changed, so ear-files may be created inconsistently.
2. They leave WSAD in a (slightly) inconsistent state, because WSAD complains afterwards that the context root of the Enterprise and the Web Application Project differ (OK, I agree: this could be handled by ant, by setting back the files, but this makes it unnecessary complicated)

Does anybody have an idea or experiences with dealing with such a problem?