tomcat-maven-plugin 插件使用

在pom.xm中引入插件web

<plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>tomcat-maven-plugin</artifactId>
      <version>1.1</version>
      <configuration>
           <path>/wp</path>
           <port>8080</port>
           <uriEncoding>UTF-8</uriEncoding>
           <server>tomcat6</server>
       </configuration>
 </plugin>apache

path  是访问应用的路径tomcat

port 是tomcat 的端口号maven

uriEncoding  URL按UTF-8进行编码,这样就解决了中文参数乱码。ui

Server 指定tomcat名称。编码


插件运行.net

若是Eclipse 安装了Maven插件,选 择pom.xml文件,击右键——>选择 Run As——> Maven build 插件


tomcat7-maven-plugin 使用code

在pom.xml中引入tomcat7插件,使用和上述同样,运行命令换成tomcat7:runserver


      <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.1</version>
            <configuration>
                <port>80</port>
                <path>/WeiXinApply</path>
                <uriEncoding>UTF-8</uriEncoding>
                <finalName>WeiXinApply</finalName>
                <server>tomcat7</server>
            </configuration>
        </plugin>


经常使用命令以下:

命令    描述 tomcat:deploy    部署一个web war包 tomcat:reload    从新加载web war包 tomcat:start 启动tomcat tomcat:stop 中止tomcat tomcat:undeploy 中止一个war包 tomcat:run    启动嵌入式tomcat ,并运行当前项目

相关文章
相关标签/搜索