参考 http://jira.codehaus.org/browse/JETTY-1503
写道
Don't forget you can use the following to specify which jars to scan in your webapp:
org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern
eg
./.*foo-api-[^/]\.jar$|./.*bar-[^/]\.jar$|./.*wibble[^/]\.jar$
org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern
eg
./.*foo-api-[^/]\.jar$|./.*bar-[^/]\.jar$|./.*wibble[^/]\.jar$
在使用maven开发web项目极大地方便了jar包的依赖,在测试时也可以集成Servlet容器,从启动速度和量级上看,Jetty无疑是不二选择, 然而从8.x开始,如果你的web项目中不包含数据库访问(或者说没有事务管理器)的话,在其启动时会提示找不到事务管理器,输出信息如下:
oejpw.PlusConfiguration:No Transaction manager found - if your webapp requires one, please configure one.
而且启动过程会暂停十几秒,在反复调试代码时很浪费时间,经过多天在网上搜索资料,终于找到了解决办法。
首先是pom.xml中关于插件的配置:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.16.v20140903</version> <configuration> <jettyXml>conf/jetty.xml,conf/jetty-ssl.xml</jettyXml> <contextXml>conf/jetty-contexts.xml</contextXml> <scanIntervalSeconds>10</scanIntervalSeconds> <webApp> <contextPath>/</contextPath> </webApp> </configuration> </plugin>
重要的是加上
<contextXml>
配置,我们要对jetty的服务器属性进行配置。本例中把配置文件放到了/src/main/resources中(如果你不希望打包时带上这个文件,可 以放到/src/test/resources中,改下配置即可),文件名为:jetty-context.xml。接下来是配置文件:
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!-- =============================================================== --> <!-- Add a ContextProvider to the deployment manager --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- This scans the webapps directory for war files and directories --> <!-- to deploy. --> <!-- This configuration must be used with jetty-deploy.xml, which --> <!-- creates the deployment manager instance --> <!-- =============================================================== --> <Configure id="Server" 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>
相关推荐
maven jetty 插件,直接放在ide的插件包即可
maven集成jetty必须jar包maven-jetty-plugin,内含多个版本
jetty 6 maven官方插件 ,在maven官网下载的
在使用jetty时,如果修改html 或者CSS、JS等代码,发现只要被浏览器加载过的文件,都会被锁住,修改之后无法保存。附件文档就是教你怎么修改这个问题。绝对亲自调试,不是从网上转载
maven jetty插件配置指南。 看看就知道。
maven-jetty-jspc-plugin-6.1.25-sources.jar
idea+maven+jetty,整合最简单实例。
maven使用jetty启动,在pom.xml文件中添加Jetty plugin引用
经过一番折腾,终于把jetty与Maven结合起来,做了一个web小项目,瑾此传上去,供大家分享。
jetty maven pom run ---------------------------------------- http://knight-black-bob.iteye.com/blog/2360698
apache-maven的插件包:apache-maven-3.3.9-bin.zip。。
详细介绍Eclipse+maven+jetty开发环境搭建
NULL 博文链接:https://shigenkun.iteye.com/blog/1561275
maven-jetty6-plugin-1.0.jar
jdk1.7 jetty9.2.13 maven3.3.3 很基础的例子,来自官网,写成了DEMO,更加方便学习。包括jetty作为Http 服务器和 Web 容器的基础实现。
java开发中Eclipse+maven+jetty环境配置
maven的项目用jetty 服务器启动项目时配置此段配置,就可以实现热部署(意思就是eclipse改了代码可以不用重启服务器)
可是在网上又找不到对应的m2e包(我用的eclipse4.7),于是我决定将站点下的文件(很多)用爬虫爬下来,打包成离线插件包,再通过网上提供的多种离线安装插件的方法,我终于能自由的安装eclipse的maven插件了。...
对于eclipse无法在线安装maven插件的解决办法。首先windows配置maven环境,然后在eclipse离线安装maven插件。具体方法可以在我的博客中看到