方式一、采用mortbay插件:

1、pom.xml

<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>8.1.15.v20140411</version>
<configuration>
<stopKey>stop</stopKey>
<stopPort>9998</stopPort>
<scanIntervalSeconds>1</scanIntervalSeconds>
<contextXml>${project.basedir}/src/test/resources/jetty-context.xml</contextXml>
<webApp>
<contextPath>/${project.artifactId}</contextPath>
</webApp>
<connectors>
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
<port>9999</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
</configuration>
</plugin>

注:对于org.eclipse.jetty.server.nio.SelectChannelConnector,即使没引入该jar包,也没影响。

2、jetty-context.xml

关键是在${project.basedir}/src/test/resources/目录下,创建文件:jetty-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg>
<Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
</Call>
</Configure>

3、右上角maven窗口【刷新】,后,

方式二、采用eclipse插件:

1、jetty&jdk版本

9.3----->1.8
9.2----->1.7
8------->1.6

参考:https://www.eclipse.org/jetty/documentation/current/jetty-maven-plugin.html

2、pom.xml

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.26.v20180806</version>
<configuration>
<httpConnector>
<port>9999</port>
</httpConnector>
<scanIntervalSeconds>10</scanIntervalSeconds>
<webAppConfig>
<contextPath>/ebc_signpdf</contextPath>
</webAppConfig>
</configuration>
</plugin>

我用eclipse下的jetty插件时,报错:java.lang.Exception: Timeout scanning annotations。需要每次启动时,执行

mvn jetty:run -Dorg.eclipse.jetty.annotations.maxWait=120

才能解决,但是过于麻烦,因此建议采用mortbay插件。

最新文章

  1. javascript遍历子元素
  2. Map中如何把没有定义操作符&lt;的类作为key
  3. codeforces 391C3 - The Tournament
  4. java中使用队列:java.util.Queue
  5. WPF动画
  6. Angular内置指令
  7. HTTP协议----ETag
  8. github 教程
  9. VBA编程的工程性规划
  10. 基于synchronized实现的阻塞队列
  11. [Swift]LeetCode42. 接雨水 | Trapping Rain Water
  12. powershell ParameterSet解析
  13. 详细理解平衡二叉树AVL与Python实现
  14. window.location.herf=url参数有中文,到后台乱码问题解决
  15. 从零写Java Web框架——请求的处理DispatcherServlet
  16. free命令的具体含义
  17. sql优化 表连接join方式
  18. Leetcode 90
  19. java版云笔记(五)
  20. python requests的使用说明

热门文章

  1. bluebird的安装配置
  2. 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-001分析步骤
  3. Luogu 1979 [NOIP2013] 华容道
  4. Mysql--连接查询
  5. springmvc和js前端的数据传递和接收方式
  6. [转]Oracle截取字符串相关函数
  7. JDBC 配置环境
  8. Leafletjs学习教程和相关代码整理
  9. 【Arcgis for android】Error inflating class com.esri.android.map.MapView【已解决】
  10. Mybatis基于代理Dao实现CRUD操作 及 Mybatis的参数深入