idea(3)-jetty配置
2024-08-24 00:24:10
方式一、采用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插件。
最新文章
- javascript遍历子元素
- Map中如何把没有定义操作符<;的类作为key
- codeforces 391C3 - The Tournament
- java中使用队列:java.util.Queue
- WPF动画
- Angular内置指令
- HTTP协议----ETag
- github 教程
- VBA编程的工程性规划
- 基于synchronized实现的阻塞队列
- [Swift]LeetCode42. 接雨水 | Trapping Rain Water
- powershell ParameterSet解析
- 详细理解平衡二叉树AVL与Python实现
- window.location.herf=url参数有中文,到后台乱码问题解决
- 从零写Java Web框架——请求的处理DispatcherServlet
- free命令的具体含义
- sql优化 表连接join方式
- Leetcode 90
- java版云笔记(五)
- python requests的使用说明
热门文章
- bluebird的安装配置
- 算法Sedgewick第四版-第1章基础-1.4 Analysis of Algorithms-001分析步骤
- Luogu 1979 [NOIP2013] 华容道
- Mysql--连接查询
- springmvc和js前端的数据传递和接收方式
- [转]Oracle截取字符串相关函数
- JDBC 配置环境
- Leafletjs学习教程和相关代码整理
- 【Arcgis for android】Error inflating class com.esri.android.map.MapView【已解决】
- Mybatis基于代理Dao实现CRUD操作 及 Mybatis的参数深入