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

mck*_*mey 14 windows jetty maven-plugin maven-3 maven-jetty-plugin

我试图通过在webdefault.xml 中设置为false 的技术来解决Jetty在Windows锁定静态文件常见问题useFileMappedBuffer.不幸的是,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>
...
Run Code Online (Sandbox Code Playgroud)

这是我的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>
Run Code Online (Sandbox Code Playgroud)

我也尝试改变文件的路径:

<webDefaultXml>${basedir}/src/main/resources/webdefault.xml</webDefaultXml>
Run Code Online (Sandbox Code Playgroud)

我到处都看到了这个确切的解决方案,听起来它正在为其他人工作(虽然我找到了一个有人有我问题的实例).jetty的启动在输出中有这个:

> mvn jetty:run
...
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
...
Run Code Online (Sandbox Code Playgroud)

这进一步让我觉得它没有得到应用.输出中的所有其他路径都是正确的.

我在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)
Run Code Online (Sandbox Code Playgroud)

在我停止Jetty后,它保存得很好.每次都会发生这种情况

我有什么想法可能做错了吗?提前致谢.

mck*_*mey 15

我找到了一个与新的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>
Run Code Online (Sandbox Code Playgroud)

这似乎适用于较新的插件.我仍然不确定为什么v6插件没有拿起自定义配置.