我试图通过在webdefault.xml中将useFileMappedBuffer设置为false的技术来绕过
common issue of Jetty locking static files on Windows.不幸的是,每次Jetty都没有拿起我自定义的webdefault.xml.
我使用Apache Maven 3.0.2.我试过使用maven-jetty-plugin (v6.1.26)和jetty-maven-plugin (v8.0.0.M2),但没有任何区别.在运行Jetty之前,我已经尝试运行清洁和重建.
我每次验证我的webdefault.xml是与插件相同的版本,并具有正确的设置,即仅将此设置从true更改为false:
... <init-param> <param-name>useFileMappedBuffer</param-name> <param-value>false</param-value> </init-param> ...
这是我的pom.xml Jetty插件部分看起来像:
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<configuration>
<contextpath>/</contextpath>
<webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
</configuration>
</plugin>
我也试过改变我的文件的路径:
<webDefaultXml>${basedir}/src/main/resources/webdefault.xml</webDefaultXml>
Everywhere I’ve seen this exact solution,它听起来像是为别人工作(尽管我发现了one instance where someone had my issue).在码头的启动有这样的输出:
> mvn jetty:run ... [INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml [INFO] Web overrides = none ...
这进一步让我觉得没有被应用.所有其他路径在输出中都是正确的.
Jetty正在运行时我看到的最直接的问题是每当我使用IntelliJ IDEA 10编辑静态文件(JavaScript,CSS等)时,都会收到以下错误消息:
Cannot save file: D:\...\... (The requested operation cannot be performed on a file with a user-mapped section open)
在我停止码头之后,它保存得很好.每次都会发生.
任何想法我可能做错了什么?提前致谢.
对于较新的Jetty插件jetty-maven-plugin(v8.0.0.M2),我发现了一个完全不同的文档,并且看起来配置名称已更改:
http://wiki.eclipse.org/Jetty/Reference/webdefault.xml#Using_the_Jetty_Maven_Plugin
<project>
...
<plugins>
<plugin>
...
<artifactId>jetty-maven-plugin</artifactId>
<configuration>
<webAppConfig>
...
<defaultsDescriptor>/my/path/to/webdefault.xml</defaultsDescriptor>
</webAppConfig>
</configuration>
</plugin>
...
</plugins>
...
</project>
现在这似乎适用于较新的插件.我仍然不确定为什么v6插件没有选择自定义配置.