如何为 tomcat-maven-plugin 配置额外的上下文路径? [英] How do I configure an additional context path for tomcat-maven-plugin?
问题描述
我使用 Maven 3.0.3 和 Tomcat 插件.使用 Maven 和 Tomcat,我想部署该站点的嵌入式实例.我的问题是如何在嵌入式 Tomcat 服务器中配置额外的上下文路径?以下是我的 Tomcat 配置,但我的
规范无效或该文件的内容(如下)无效:
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>
因为当我调用
mvn clean -Dmaven.test.skip=true verify -Ptomcat tomcat:run
映射到 /all-new-jx-web
(我的附加上下文路径)的 URL 都没有被映射(Tomcat 不提供资产).任何想法为什么?下面是我的 pom.xml
文件中的 tomcat 配置文件:
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>
推荐答案
使用 serverXml
配置.
Use the serverXml
configuration for that.
这篇关于如何为 tomcat-maven-plugin 配置额外的上下文路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!