tomcatmaven-2mavenmaven-tomcat-plugin

How do I configure an additional context path for tomcat-maven-plugin?


I'm using Maven 3.0.3 with the Tomcat plugin. Using Maven and Tomcat, I would like to deploy an embedded instance of the site. My question is how do I configure an additional context path in my embedded Tomcat server? Below is my Tomcat configuration, but either my <contextFile> specification is invalid or the contents of that file (below) are invalid:

<Context path="/all-new-jx-web" docBase="/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/target/web">
</Context>

because when I invoke

mvn clean -Dmaven.test.skip=true verify -Ptomcat tomcat:run

none of the URLs mapped to /all-new-jx-web (my additional context path) are getting mapped (assets aren't being served by Tomcat). Any ideas why? Below is my tomcat profile from my pom.xml file:

<profile>
  <id>tomcat</id>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>tomcat-maven-plugin</artifactId>
        <version>1.1</version>
        <configuration>
          <contextFile>config/tomcat/context.xml</contextFile>
          <mode>context</mode>
          <addContextWarDependencies>true</addContextWarDependencies>
          <charset>UTF-8</charset>
          <path>/all-new-jx</path>
          <update>true</update>
          <warDirectory>target/${project.artifactId}-${project.version}.${project.packaging}</warDirectory>
          <systemProperties>
            <JAVA_OPTS>-Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:NewRatio=6
                -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
                -verbose:gc"
            </JAVA_OPTS>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>
</profile>

Solution

  • Use the serverXml configuration for that.