折雨的天空

新浪微薄腾讯微薄

最新碎语:最近霉到了住。哎。。。

您的位置:折雨的天空 >其他技术> maven配置tomcat记录

maven配置tomcat记录

默认可以不配置,执行

mvn tomcat:run
默认监听8080端口,注意。


配置插件,使用tomcat7 


<plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.2</version>
          <configuration>
            <port>8888</port>
          </configuration>
        </plugin>


指定了端口。


更完整的配置:


 <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>

            <configuration>                
                <path>/</path> <!-- 项目访问路径 本例:localhost:9090, 如果配置的aa,则访问路径为localhost:9090/aa -->
                <port>9090</port>
                <uriEncoding>UTF-8</uriEncoding><!-- 非必需项 -->
            </configuration>
        </plugin>

这个时候不能使用mvn tomcat:run了。

需要使用:

[#zeyu#]

mvn tomcat7:run

[/#zeyu#]

成功之后提示:


八月 12, 2020 10:02:35 下午 org.apache.coyote.AbstractProtocol init
信息: Initializing ProtocolHandler ["http-bio-8888"]
八月 12, 2020 10:02:35 下午 org.apache.catalina.core.StandardService startInternal
信息: Starting service Tomcat
八月 12, 2020 10:02:35 下午 org.apache.catalina.core.StandardEngine startInternal
信息: Starting Servlet Engine: Apache Tomcat/7.0.47
八月 12, 2020 10:02:38 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8888"]

参考:https://www.cnblogs.com/afeng2010/p/10224597.html


还刚开始学,后面路还很长。

------------正 文 已 结 束, 感 谢 您 的 阅 读 (折雨的天空)--------------------

转载请注明本文标题和链接:《maven配置tomcat记录

奖励一下

取消

分享不易,烦请有多多打赏,如您也困难,点击右边关闭即可!

扫码支持
扫码打赏,5元,10元,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

-秒后自动关闭,如已打赏,或者不愿打赏,请点击右上角关闭图标。

发表评论

路人甲 表情
看不清楚?点图切换