Sublime Text 3修改文件后Eclipse不更新,JSF项目浏览器无变化求助
I’ve run into this exact frustration before—external editors not syncing properly with Eclipse’s deployment pipeline can grind your HTML/CSS development to a halt. Let’s walk through the most reliable fixes to get your changes showing up instantly:
1. Enable Eclipse Workspace Auto-Refresh
Eclipse doesn’t automatically watch for file changes made outside the IDE by default. Fix that:
- Go to
Window > Preferences > General > Workspace - Check both Refresh using native hooks or polling and Refresh on access
- Click Apply/OK. This makes Eclipse pick up edits from Sublime Text in real time.
2. Turn On Automatic Project Builds
If Eclipse isn’t rebuilding your project when files change, updated resources won’t get deployed to the server:
- Click the
Projectmenu at the top of Eclipse - Ensure Build Automatically is checked (it should have a checkmark next to it)
3. Tweak Server Publishing Settings
Even if Eclipse detects changes, it might wait too long to push them to your server:
- Open the
Serversview (if hidden, go toWindow > Show View > Servers) - Right-click your server (e.g., Tomcat) and select
Properties - Navigate to the
Publishingsection - Choose Automatically publish when resources change
- Set the Publishing interval to 1 second (down from the default 15)
- Click Apply/OK. This ensures Eclipse deploys updates the moment they’re detected.
4. Disable Server-Side Resource Caching
Most application servers cache static resources (like HTML/CSS) for performance—great for production, but a headache during development:
For Tomcat:
- Open your server’s
context.xmlfile (either in Eclipse’s Servers project or your Tomcat installation’sconffolder) - Add
<Resources cachingAllowed="false"/>inside the<Context>element. Example:<Context> <Resources cachingAllowed="false"/> <!-- existing server config --> </Context> - Restart your server to apply the change.
5. Bypass Browser Caching
Even if the server sends updated files, your browser might still serve cached versions:
- Use a hard refresh instead of a normal refresh:
Ctrl+F5(Windows/Linux) orCmd+Shift+R(Mac) - Or disable caching temporarily in your browser’s dev tools:
- Open DevTools with
F12 - Go to the Network tab
- Check the Disable cache box (this works only while DevTools is open)
- Open DevTools with
6. Verify Deployment Assembly
Double-check that your HTML/CSS files are actually being included in the deployed application:
- Right-click your project in Eclipse >
Properties > Deployment Assembly - Ensure folders containing your HTML/CSS (e.g.,
WebContent,src/main/webapp) are mapped to the root/of your deployed app - If missing, click
Add > Folderto include them.
Start with the first three steps—they’re the most likely to solve your problem. If not, moving to server and browser caching tweaks should resolve the delay.
内容的提问来源于stack exchange,提问作者3gwebtrain

