gpt4 book ai didi

windows - Jetty Maven 插件忽略自定义 webdefault.xml

转载 作者:可可西里 更新时间:2023-11-01 12:27:29 25 4
gpt4 key购买 nike

我正在尝试绕过 common issue of Jetty locking static files on Windows使用在 webdefault.xml 中将 useFileMappedBuffer 设置为 false 的技术。不幸的是,每次 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 )。 jetty 的启动在输出中有这个:

> 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 插件 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 插件没有选择自定义配置。

关于windows - Jetty Maven 插件忽略自定义 webdefault.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4988019/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com