chenjiali 发表于 2017-2-1 10:22:50

Maven中的org.codehaus.mojo的tomcat配置


[*]maven构建web项目的时候用tomcat做container的时候,我们可以在maven中配置
[*]“老的”插件官网:http://mojo.codehaus.org/tomcat-maven-plugin/index.html,当然这个插件被apache搞过去了,新的:http://tomcat.apache.org/maven-plugin.html。稍微看了下apache的tomcat6/7配置方法,觉得还是老的适合,够用就行了,反正只是个小插件。
[*] 
<build>
<finalName>test-mvc</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<!-- 这是因为我local resp的原因 -->
<!-- <version>1.2-SNAPSHOT</version> -->
<configuration>
<url>http://www.mydomain.com</url>
<!--<path>${project.build.finalName}</path>-->
<path>/mypath</path>
<port>80</port>
<uriEncoding>utf-8</uriEncoding>
</configuration>
</plugin>
</plugins>
</build>
 
[*]
Since version 2.0-beta-1 tomcat mojos has been renamed to tomcat6 and tomcat7 with the same goals.
You must configure your pom to use this new groupId:

<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://websocket.demo.cc</url>
<port>80</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://websocket.demo.cc</url>
<port>80</port>
<path>/</path>
<uriEncoding>utf-8</uriEncoding>
</configuration>
</plugin>
</plugins>
 

[*]插件代码贴出来没什么好说的了,一看就懂了,方便查询。其他一些什么多个容器。。什么的goals自己去查阅两个官方的文档即可
[*]插件org.codehaus.mojo:                                            http://mojo.codehaus.org/tomcat-maven-plugin/index.html
[*]插件org.apache.tomcat.maven: http://tomcat.apache.org/maven-plugin.html
页: [1]
查看完整版本: Maven中的org.codehaus.mojo的tomcat配置