简体   繁体   English

让IntelliJ IDEA刷新项目并检测更改的文件

[英]have IntelliJ IDEA refresh the project and detect changed files

I'm using Eclipse for development because of all the things IntelliJ can't do (eg highlight all instances of a variable) and because IntelliJ is dog slow over a remote connection. 我之所以使用Eclipse进行开发,是因为IntelliJ不能做的所有事情(例如,突出显示变量的所有实例),并且因为IntelliJ在远程连接上速度慢。 But because I still don't have Maven integrated completely into Eclipse, I have to switch back to IntelliJ to compile and run my project using Tomcat. 但是由于仍然没有将Maven完全集成到Eclipse中,因此我必须切换回IntelliJ来使用Tomcat编译和运行我的项目。

How can I tell IntelliJ to detect all files that have changed on the file system and recompile them? 如何告诉IntelliJ检测文件系统上所有已更改的文件并重新编译它们? (I don't want to manually open each changed file to get IntelliJ to detect the change.) In Eclipse I would just Refresh the project tree [ 1 ]... (我不想手动打开每个更改的文件来获取IntelliJ来检测更改。)在Eclipse中,我只是刷新项目树[ 1 ] ...

Footnotes : 脚注

  1. Eclipse has a feature (named " Refresh Using native hooks or polling ") which you can enable to automatically detect changes and synchronise the perspective when any underlying changes are detected in the filesystem (see images below). Eclipse具有一项功能(名为“ 使用本机钩子或轮询刷新 ”),当在文件系统中检测到任何基础更改时,可以启用该功能来自动检测更改并同步透视图(请参见下图)。 This is quite handy and eliminates the need to manually refresh the project when using build tools - where files/directories get created in the project directory structure. 这非常方便,使用构建工具时无需手动刷新项目-在项目目录结构中可以在其中创建文件/目录。

Is there anything similar for Intellij (explicit setting or otherwise) that eliminates having to click a button to synchronize the view with filesystem changes? 是否有Intellij的类似功能(显式设置或其他设置),从而无需单击按钮即可将视图与文件系统更改同步?

“刷新使用本机挂钩或轮询”设置

您可以使用“同步”按钮(两个黄色箭头)或简而言之Ctrl + Alt + Y

Intellij can highlight variable instances, you just need to enable it . Intellij可以突出显示变量实例,您只需要启用它即可。 Further, if you invoke compile project, Intellij will just compile changed files (and hotswap when possible, if you are in debug mode & deploying to eg tomcat) 此外,如果您调用编译项目,则Intellij只会编译更改的文件(如果可能,如果处于调试模式并部署到例如tomcat,则在可能时进行热交换)。

Right click on your Project in the left pane and click on "Synchronize" 右键单击左窗格中的项目,然后单击“同步”

You can see the status in the round circling icon at the bottom left of the IDE 您可以在IDE左下方的圆形图标中查看状态

I know this question was posted a few years ago, but maybe this info will help someone in the future. 我知道这个问题是几年前发布的,但也许此信息将来会对您有所帮助。 I was actually looking into a similar issue, and doing the following worked for me: 我实际上正在调查一个类似的问题,并且为我做以下工作:

Go to Settings > Build, Execution, Deployment > Compiler and make sure "Make project automatically" is checked. 转到设置>构建,执行,部署>编译器,并确保选中“自动创建项目”。

单击文件>同步(或)快捷键ctrl + Alt + Y

There is a synchronise button in the tool bar. 工具栏中有一个同步按钮。 Click it and it will refresh the project explorer 单击它,它将刷新项目浏览器

同步按钮

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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