maven 插件jetty/tomcat启动 web 应用

tomcat

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                   <configuration>
                      <path>/</path>
                      <port>8000</port>
                      <uriEncoding>UTF-8</uriEncoding>  
                      <server>tomcat7</server>
                   </configuration>
                    <executions>
                        <execution>
                            <phase>package</phase>
                            <goals>
                                <goal>run</goal>
                            </goals>
                        </execution>
                    </executions>
            </plugin>

启动方法:mvn tomcat7:run

jetty

    <plugins>
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>9.4.5.v20170502</version>
        <configuration>
          <scanIntervalSeconds>10</scanIntervalSeconds>
          <httpConnector>
            <port>80</port>
          </httpConnector>
          <webAppConfig>
            <contextPath>/</contextPath>
          </webAppConfig>
        </configuration>
      </plugin>
    </plugins>
<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>jetty-maven-plugin</artifactId>
    <version>8.1.16.v20140903</version>
    <configuration>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <connectors>
            <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                <port>7777</port>
            </connector>
        </connectors>
        <webAppConfig>
            <contextPath>/</contextPath>
        </webAppConfig>
    </configuration>
</plugin>

scanIntervalSeconds元素表示该插件扫描项目变更的时间间隔,这里配置为10秒。默认为0,表示不扫描,这样就失去了自动化热部署的功能。
connector 元素用来指定运行的端口号,属性 implementation 不可以删除,值是固定的。默认端口是8080。
启动方法:mvn jetty:run -Djetty.port=9999
启动后,可以在IDE中修改jsp、htmo、css、js甚至java类,只要不是修改类名、方法名等较大的操作,插件都能够扫描变更并更新到web容器中

转载于:https://www.cnblogs.com/Mike_Chang/p/9383475.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值