首页 > 技术文章 > maven jetty 启动后,不能修改静态文件,js,css,html

developer-os 2017-07-03 10:23 原文

解决办法:

1.从jetty的jar包中(位置可能不同,有的jetty-web中)拷贝一份webdefault.xml文件

2.将webdefault.xml 中的useFileMappedBuffer  设置为false。

<init-param>
<param-name>useFileMappedBuffer</param-name>
<param-value>false</param-value>
</init-param>

3.将webdefault.xml文件放在maven web 的pom同级目录
4.修改maven中<configuration>属性,在属性中添加如下配置

<webAppConfig>
<contextPath>/meds</contextPath>
<defaultsDescriptor>webdefault.xml</defaultsDescriptor>
</webAppConfig>

注意:jetty版本不同,可能配置并不相同,有可能不好用,以上配置是在9.4.1.v20170120中是好用的,但在别的版本下可能不好用。

推荐阅读