Overriding default web application context root in Maven 2
Posted on 20-June-2008. Incase you have any difficulty in configuration please post in our
Forum.
Let us assume you have to create atleast one web module in a JEE project. By default Maven
assigns a context root whose value is the same as the value of
artifactId
in the pom.xml of the web module. The below description helps in overriding this default
behaviour.
The below screenshot shows the pom.xml of the web project [module]. Hence the
application.xml
inside the EAR packed will have the context root as
theaweb [which is nothing but the value
of artifactId].
To override this default behaviour [assuming the context root should be
newtheaweb],
we specify the following in the
pom.xml of the EAR project as in the screenshot below.
Please note that the specification is within the
maven-ear-plugin.
Incase we wish to provide the root context, we must provide a "/" as shown in the screen shot below.
Leaving it blank will make Maven 2 to substitute with the default context root which is theaweb.