Jetty Maven插件将忽略自定义webdefault.xml [英] Jetty Maven Plugin is ignoring custom webdefault.xml

查看:334
本文介绍了Jetty Maven插件将忽略自定义webdefault.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试避开常见的Jetty锁定问题Windows中的文件,其技术是在webdefault.xml中将useFileMappedBuffer设置为false.不幸的是,每次Jetty都不选择我自定义的webdefault.xml.

I'm trying to get around the common issue of Jetty locking static files on Windows with the technique of setting useFileMappedBuffer to false in webdefault.xml. Unfortunately, every time Jetty is not picking up my customized webdefault.xml.

我正在使用Apache Maven 3.0.2.我尝试使用 maven-jetty-plugin(v6.1.26) jetty-maven-plugin(v8.0.0.M2),但没有区别.在运行Jetty之前,我还尝试过干净运行和重建.

I'm using Apache Maven 3.0.2. I've tried using the maven-jetty-plugin (v6.1.26) and jetty-maven-plugin (v8.0.0.M2) but with no difference. I've tried running clean and rebuilding as well before running Jetty.

我每次都从与插件相同的版本中获取webdefault.xml并具有正确的设置(即,仅将此设置从true更改为false)时进行了验证:

I've verified each time that my webdefault.xml was taken from the same version as the plugin and has the correct settings, namely, only changing this setting from true to false:

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

这是我的pom.xml Jetty插件部分的样子:

And here's what my pom.xml Jetty plugin section looks like:

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <configuration>
        <contextPath>/</contextPath>
        <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
    </configuration>
</plugin>

我还尝试过更改文件的路径:

I've also tried altering the path to my file:

<webDefaultXml>${basedir}/src/main/resources/webdefault.xml</webDefaultXml>

在任何地方,我都看到过这种精确的解决方案听起来好像对其他人有用(尽管我发现有人遇到我的问题的一个实例). Jetty的启动在输出中有以下内容:

Everywhere I've seen this exact solution and it sounds like it is working for others (although I found one instance where someone had my issue). The startup for jetty has this in the output:

> mvn jetty:run
...
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = none
...

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

This further makes me think it isn't being applied. All the other paths are correct in the output.

在Jetty运行时,我看到的最直接的问题是,每当我使用IntelliJ IDEA 10编辑静态文件(JavaScript,CSS等)时,都会收到以下错误消息:

My most direct issue that I'm seeing while Jetty is running is that whenever I edit a static file (JavaScript, CSS, etc.) with IntelliJ IDEA 10, I get this error message:

Cannot save file:
D:\...\... (The requested operation cannot be performed on a file with a user-mapped section open)

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

After I stop Jetty then it saves just fine. This happens every time.

有什么想法我可能做错了吗?预先感谢.

推荐答案

我为较新的Jetty插件jetty-maven-plugin(v8.0.0.M2)找到了一个完全不同的文档,看起来配置名称已更改:

I found an entirely different doc for the newer Jetty plugin jetty-maven-plugin (v8.0.0.M2) and it looks like the configuration name has changed:

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插件无法选择自定义配置.

This now seems to work for the newer plugin. I'm still unsure why the v6 plugin does not pick up the customized config.

这篇关于Jetty Maven插件将忽略自定义webdefault.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆