zoukankan      html  css  js  c++  java
  • 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容器中

  • 相关阅读:
    Unzip 解压报错
    Linux ftp安装
    关于vsftp出现Restarting vsftpd (via systemctl): Job for vsftpd.service failed because the control 的解决办法
    ASP.NET开发知识总结
    移动端开发调试方法总结
    移动H5优化指南
    基于windows下,node.js之npm
    微服务理解
    SQL Server 触发器
    jQuery验证控件jquery.validate.js使用说明+中文API
  • 原文地址:https://www.cnblogs.com/Mike_Chang/p/9383475.html
Copyright © 2011-2022 走看看