简体   繁体   中英

Intellij IDEA 12.1.7 JavaScript file not updating when application runs

I am creating a Spring application that uses a JavaScript file that implements a date picker. When I first ran the page which contained the date picker I had made a syntax error on the function declaration which I fixed. However on running the application again the JavaScript file is not updating so the version of the file with the error is being run.

If it helps here is the code with the error:

$(function()){
       $("#createdTime, #expi").datepicker({
             dateFormat:  "d-m-yy"
       });
}

And here it is fixed:

$(function(){
       $("#createdTime, #expiryTime").datepicker({
             dateFormat:  "dd-mm-yy"
       });
});

The slightly different id "expiryTime" is correct according to my HTML.

I think this is an IDE issue but am not 100% sure. I tried to clear the cache but this did not make any difference. If it helps I am using Intellij IDEA 12.1.7.

我通过重新运行应用程序然后使用 Control + F5 解决了这个问题。

In my case the problem was in chrome browser behavior. Try Developer Tools(F12) > Network > Disable cache.

If anyone else runs into this problem: user1849060's solution will likely help. But also, I noticed in Chrome at least, I had to F5 the page itself so that the cached away Javascript was cleared out. Then the new Javascript was used.

I've run into this problem before with Chrome + IntelliJ caching away old Javascript, so I thought I would give my 2 cents.

Here are some things I've picked up, in order of how badly the js & intellij is treating you.

  1. Ctrl+f5 (empty cache and refresh)
  2. Inspect, navigate to js file, open file in new tab, change a letter of the file's case & refresh
  3. Grade: use Tasks > Build> Clean

Gradle will build to your project folder so look at the Build > Resources folder, deleting it is sometimes needed if intellij is refusing to reload a static JS file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM