用Maven + Jetty 在Eclipse环境启动后,改静态文件的时候出现如下提示

就表示文件被锁住了。

解决办法如下:

       <plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.0.RC0</version>
<configuration>
<webAppSourceDirectory>WebContent</webAppSourceDirectory>
<scanIntervalSeconds>3</scanIntervalSeconds>
<contextXml>src/main/resources/jetty-contexts.xml</contextXml>
<webAppConfig>
<contextPath>/mylog4j</contextPath>
<!-- 此处指定默认Jetty Web配置文件 -->
<defaultsDescriptor>src/main/resources/webdefault.xml</defaultsDescriptor>
</webAppConfig>
</configuration>
</plugin>
webdefault.xml 文件从你引用的jetty-webapp-*.jar中,org/eclipse/jetty/webapp/webdefault.xml复制一份出来,修改其中一个配置项:
<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value><!-- 修改成false -->
</init-param>

到此,重启工程看到控制台输出如下:

[INFO] Applying context xml file src/main/resources/jetty-contexts.xml
[INFO] Context path = /mylog4j
[INFO] Tmp directory = H:\neon\neon-workspace\mylog4j\target\tmp
[INFO] Web defaults = src/main/resources/webdefault.xml
[INFO] Web overrides = none

看到红色的这一行,表示已经使用你配置的webdefault.xml

至此,问题就解决了。

另外在有些版本中,webdefault.xml配置是在<configuration>标签下用<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>指定。

参考:http://stackoverflow.com/questions/4988019/jetty-maven-plugin-is-ignoring-custom-webdefault-xml

最新文章

  1. Android -- 软键盘
  2. Christmas Trees, Promises和Event Emitters
  3. 2015-2016-2 《Java程序设计》 游戏化
  4. atitit. groupby linq的实现(1)-----linq框架选型 java .net php
  5. 常用js表单文本域验证
  6. Pencil OJ 02 安装
  7. It&#39;s only too late if you decide it is. Get busy living, or get busy dying(转)
  8. 关于preg_match()函数的一点小说明
  9. DevOps之存储和数据库
  10. 听说图像识别很难,大神十行代码进行Python图像识别
  11. Django admin自定制功能
  12. 6.linux安装tomcat
  13. jupyter notebook + frp 实现内容穿透
  14. Linux命令一
  15. Mad LIbs小游戏
  16. python第六十一天,第六十二天 redis
  17. 修改MySQL的默认密码的四种小方法
  18. 【第七章】MySQL数据库备份-物理备份
  19. RS232引脚,RS485引脚
  20. sonarQube安装及本机扫描C#项目

热门文章

  1. B4:策略模式 Strategy
  2. hdu1509(Windows Message Queue) 优先队列
  3. java 学习帮助
  4. C-类型转换(陷阱)
  5. [DevExpress]XtraTabControl右键加入关闭当前页、关闭其它页、所有关闭的实现
  6. nginx 404重定向到自定义页面
  7. MTU的概念,什么是路径MTU? MTU发现机制,TraceRoute(了解)
  8. Atitit.互联网 软件编程 数据库方面 架构 大牛 牛人 attilax总结
  9. java-MapDemo
  10. ConcurrentHashMap的JDK1.8实现