mvn tomcat:run - 如何编辑 server.xml?
我想从命令行运行“mvn tomcat:run”,但如何编辑 server.xml 以在连接器中设置 maxHttpHeaderSize="65536" ?或者我可以在 pom.xml 中配置连接器吗?
干杯
尼克
I want to run "mvn tomcat:run" from the command line, but how can I edit the server.xml to set maxHttpHeaderSize="65536" in the connectors? Or can I configure the connectors in the pom.xml?
Cheers
Nik
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
org.codehaus.mojo:tomcat-maven-plugin 将允许您在配置部分设置 server.xml 文件的路径:
The org.codehaus.mojo:tomcat-maven-plugin will let you set the path to the server.xml file in the configuration section:
不幸的是,经过一些研究,我认为没有办法编辑 server.xml 的连接器。
mvn tomcat:run
使用嵌入式 Tomcat。除非有人找到了一些东西,否则你最好的选择似乎是转移到 maven Cargo 插件 并压缩使用自定义
server.xml
安装您自己的 Tomcat。或者类似的东西...
Unfortunately, after doing some research, I don't think there's a way to edit server.xml's connectors.
mvn tomcat:run
uses an embedded Tomcat.Unless someone finds something, it seems like your best bet will be to move to the maven cargo plugin and ZIP up your own Tomcat installation with your custom
server.xml
.Or something of the sort...
我一直在尝试使用 serverXml 参数来实现 tomcat:run 目标(http://tomcat.apache.org/maven-plugin-2/tomcat6-maven-plugin/run-mojo.html #serverXml)。
以下
server.xml
似乎运行时没有错误,但如果没有Context
元素,它不会加载 Web 应用程序。我想如果我将 Context 元素从 src/main/webapp/META-INF/context.xml 复制到 Host 元素内,它可能会正常工作:运行对于此服务器,我将 serverXml 作为 Maven 命令行上的属性传递:
如果您使用支持 Tomcat 6 和 7 的插件版本,则目标可能必须是
tomcat6:run
。I have been experimenting with using the serverXml parameter for the
tomcat:run
goal (http://tomcat.apache.org/maven-plugin-2/tomcat6-maven-plugin/run-mojo.html#serverXml).The following
server.xml
seems to run with no errors, but without aContext
element it does not load the webapp. I think if I copied myContext
element from src/main/webapp/META-INF/context.xml to inside theHost
element, it might work just fine:To run with this server, I pass the serverXml as a property on the Maven command line:
The goal might have to be
tomcat6:run
if you are using a version of the plugin that supports both Tomcat 6 and 7.请参阅http://docs.codehaus.org/display/CARGO/Custom+File+配置
我认为你可以这样做,并将自定义的server.xml放入你的项目中:
并使用默认的cargo server.xml作为模板来获取属性替换:
see http://docs.codehaus.org/display/CARGO/Custom+File+Configurations
i think you can do it like this and place your custom server.xml in your project:
and use default cargo server.xml as a template to get property replacement: