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 ,並運行當前項目

相關文章
相關標籤/搜索