如何为Maven-Tomcat插件配置其他上下文路径? [英] How do I configure an additional context path for Maven-Tomcat plugin?

查看:135
本文介绍了如何为Maven-Tomcat插件配置其他上下文路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将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 "" 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">

因为我调用

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>

感谢您提供任何解决方案和其他疑难解答步骤,-戴夫(Dave)

Thanks for any solutions and additional troubleshooting steps, - Dave

推荐答案

使用 serverXml 的配置.

Use the serverXml configuration for that.

这篇关于如何为Maven-Tomcat插件配置其他上下文路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆