Antivirus Impact on Build Speed
Some antivirus software can interfere with the IDE build process, causing builds to run dramatically slower. When you run a build in the IDE, many class files are created on your computer. If your antivirus software has real-time scanning enabled, the antivirus can force the build process to halt each time a file is created while the antivirus scans that file.
If you’re using Windows Defender, the IDE automatically checks whether you have real-time scanning enabled, and whether the scanning is configured to process directories where the IDE writes a lot of files.
The IDE offers you a possibility to exclude those directories from scanning automatically (this feature is available in 2019.2+ IDE versions).
If you prefer to perform the necessary configuration manually, you can do so by following these steps:
- Click the Start button
- Type “Windows Security”
- Click on “Virus and threat protection”
- Click on “Manage settings” under “Virus & threat protection settings”
- Scroll down if needed, and then click on “Add or remove exclusions”
- For every folder shown in the notification, press the + button, select “Folder” from the menu, and select the folder.
If you’re using a different anti-virus product, you may still be impacted by the problem, but there is no possibility to detect or correct this automatically. If you’re experiencing poor build performance, please follow the instructions of your anti-virus product to exclude the following directories from real-time scanning:
- The directory of your project
- The whole JetBrains directory for caches and settings:
Windows:
%APPDATA%\JetBrains
Linux:
%LOCALAPPDATA%\JetBrains
~/.config/JetBrains
macOS
~/.cache/JetBrains
~/Library/Application Support/JetBrains
~/Library/Caches/JetBrains
Alternatively, you may add the directory used by an exact version of IDE to store settings and caches. It should be modified with every IDE update, though. - The Gradle cache directory (
%USERPROFILE%\.gradle
)
We also recommend excluding the IDE process from the antivirus to improve the startup performance.
Caution: To ensure that your computer is safe from malicious software, you should not completely disable real-time scanning or your antivirus software.
Note: IDE runs powershell.exe process to detect if Windows Defender is active and to exclude the folders from the antivirus. This may trigger suspicious activity detection by some other antivirus tools like TrendMicro. This behavior is by design and the corresponding source code can be found on GitHub. It's safe to permit running PowerShell from the IDE.
Please sign in to leave a comment.
Please replace text: Type “Windows Security” with: Type “Virus and threat protection”,
because it doesn't work when Windows indexing service is disabled!
For Malwarebytes Premium users, go to "Settings", then to the "Exclusions" tab, press "Add Exclusion" and add your project directory.
It might be a good idea to advise the anti-virus tools to "let the files be created without delay but delay access to them until they have been fully scanned". This would also reduce the waiting time. Just as an idea. This would make it unnecessary that I exclude each project manually.
What if I accidentally dismissed the popup offering me to automatically exclude the folders from Windows Defender, is there any way to do it from the settings?
Hello! Will there be a patch that fix this issue?
Our IT-sequrity will not allow these exclusions in Windows Defender.
Our developers are local admins, but the Windows defender policy will override this.
There is no patch that can fix it on IntelliJ IDEA side. You can contact Microsoft or your AV vendor to make the antivirus faster.
Is it the Defender issue that I have to configure it every time I open IntelliJ project?
Any suggestions how to avoid it?
Do you mean that AV exclusions do not persist? Could you please file a bug with more details at https://youtrack.jetbrains.com/newIssue?project=IDEA ?
@Serge Baranov, I created the issue since
https://youtrack.jetbrains.com/issue/IDEA-224689
If what you want is only to ignore all Gradle downloading files once and for all, check my answer here:
https://stackoverflow.com/questions/56182222/gradle-downloads-triggers-windows-defender-how-can-i-exclude-files-downloaded
The actual command to run is:(with elevated `cmd`):
After doing this, you can change "
-ExclusionPath" part to:
- project folder
- %userprofile%/.gradle
- all the folder you want
This sounds like a very useful idea, but is it literally only for Windows Defender?
What if any one of a multitude of other antivirus packages are installed? For example, we have McAffee On-Access scanning. Will the options available in 2019.2 help in that instance?
If not, what is the recommended course of action? I need a clear statement on this that I can take to the IT Security department to detail exactly why on access scanning for certain files or folders should be switched off. Are you able to list the folders that this setting stops from scanning?
I get this message even though Windows Defender isn't even enabled (it is disabled via group policy). Perhaps change the code to check if Windows Defender is enabled and/or running (sc query Windefend).
Serge Baranov Is there a way to disable this Build Speed check?
Our company has a strict antivirus policy, so we cannot disable Defender. So we just want to disable the PowerShell.exe from being executed, because it is getting flagged every time a project is opened.
jorge
You should get a notification with the actions to ignore the virus check for the current project or globally. Once ignored, it will not longer check it.
Serge Baranov The popup appears on IntelliJ Ultimate, but doesn't appear on RubyMine/WebStorm where they run the PowerShell first and triggers Windows Defender. Is there a settings file we can manually edit?
I'm using version 2020.1.2 for all of these.
I've turned off my AV and it's still unusable when building. I'm going back to the previous version.
I keep solving the issue (both automatically and manually) at every start of Pycharm and the problem keep reaprearin in the next start. Annoying!
@... you can enable it as it described in Serge Baranov's answer (in <your project>/.idea/workspace.xml, property ignore.virus.scanning.warn.message)
Why does this pop-up appear each time I launch PyCharm even though the required exclusions are already specified in the Defender settings?
Diverses
IDE may not be able to read the exclusions since Windows no longer permits it: https://youtrack.jetbrains.com/issue/IDEA-247817. It's fixed in the current PyCharm version available at https://www.jetbrains.com/pycharm/download/index.html. Please update.
It may also happen if the user name has non-latin characters, see https://youtrack.jetbrains.com/issue/IDEA-224689 for more details.
Serge Baranov
Thanks. Seems to be working now
Is the anti virus check present in GoLand?
I am getting similar symptoms - i.e. build very slow and task manager shows Defender Antivirus is taking 60-70% of my CPU
I'm getting no warnings from the IDE though, and I've tried excluding my TEMP dir but this has no effect
(Using latest GoLand - 2021.3.2)
Is there a setting to deactivate this feature? That may be applied on users profiles
A bit unrelated: Learned so much, switching from EclipsePDT to PHPStorm - amazing! THX.
Our company security team is referring to following article to configure antivirus whitelist: https://intellij-support.jetbrains.com/hc/en-us/articles/206544519
Can you tell me whether there is performance impact if not entire %APPDATA%\JetBrains is trusted, but only directories under %APPDATA%\JetBrains\IntellijIDEA*? Also should this article be treated as a source of truth for Microsoft Defender configuration company-wide?
I this really a good idea? I mean If I were a malware developer, I would just have my droppers look e.g. for a .gradle folder, and deploy and execute the actual malware there. How can you put performance above IT security, especially in the enterprise context?
Microsoft has introduced Dev Drive to address these issues.
See:
It would be nice if JetBrains could do some testing and benchmarking with Dev Drive.
I couldn't find this problem in YouTrack, I sent you the screenshots! The first one is in Intellij IDE, the second one is from Microsoft Defender! (Added everything to exceptions as said, but it doesn't help! Every time, when I open a new project, it pops out like the screenshot I gave you!)