1. 程式人生 > >idea maven jetty 執行時不能儲存修改的js檔案

idea maven jetty 執行時不能儲存修改的js檔案

感謝前輩分享, 本文參考其他部落格而成。

問題: 在idea中使用maven-jetty外掛執行web專案, 專案執行中修改js會提示不能儲存。

如圖: Following errors occurred on attempt to save files:

解決:修改jetty.jar包中webdefault.xml的配置資訊, 修改useFileMappedBuffer的值為false

==========================================================================================

網上有多種解決方案, 本文通過修改maven倉庫中jetty的配置來解決該問題。

===========================================================================================

1. 配置

<plugin>
    <groupId>org.mortbay.jetty</groupId>
    <artifactId>maven-jetty-plugin</artifactId>
    <version>6.1.22</version>
    <configuration>
        <stopKey>foo</stopKey>
        <stopPort>9966</stopPort>
        <connectors>
            <connector
                    implementation="org.mortbay.jetty.nio.SelectChannelConnector">
                <port>9090</port>
                <maxIdleTime>60000</maxIdleTime>
            </connector>
        </connectors>
        <scanIntervalSeconds>10</scanIntervalSeconds>
        <webAppConfig>
            <contextPath>/</contextPath>
        </webAppConfig>
    </configuration>
</plugin>

2. 找到jetty.jar包

我的本地地址為: C:\Users\Administrator\.m2\repository\org\mortbay\jetty\jetty\6.1.22

 

3. 找到webdefault.xml配置檔案

4. 修改webdefault.xml檔案useFileMappedBuffer的值為false, 並儲存

 

5. 在idea中重新匯入maven的相關資訊, 保險起見可以重啟idea