How to not lock JS CSS static resources when using Maven + jetty

Source: Internet
Author: User

Jetty uses memory-mapped files to cache static files, including js,css files.

Under Windows, using a memory-mapped file can cause the file to be locked, so you cannot edit the JS or css file in the editor when the jetty is started.

The workaround is to change the jetty default configuration, which does not apply to memory-mapped files for caching.

The steps to resolve are as follows:

1. Find Webdefault.xml,

I take the 6.x version as an example, Jetty-6.jar in mave n R ePo /org/mortbay/jetty/jetty/6.x/jetty-6.x.jar,

The Webdefault.xml file is under package Org\mortbay\jetty\webapp.

It is recommended that you copy the webdefault.xml copy, modify it in the copy, and use the configuration of the replica instead of changing the files inside the jar package.

2. Modify the value of the Usefilemappedbuffer parameter to False

3. Specify the use of modified webdefault.xml in Pom.xml

  
 
  1. <plugins>
  2.   <plugin>
  3.     <groupId>org.mortbay.jetty</groupId>
  4.     <artifactId>maven-jetty-plugin</artifactId>
  5. <version>6.1.26</version>
  6. <configuration>
  7.   <contextPath>/ossweb</contextPath>
  8. <connectors>
  9.   <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
  10.   <port>8080</port>
  11. </connector>
  12. </connectors>
  13. <webDefaultXml>src/main/resources/webdefault.xml</webDefaultXml>
  14. </configuration>
  15.   </plugin>
  16. </plugins>


From for notes (Wiz)

How to not lock JS CSS static resources when using Maven + jetty

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.