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 still may 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 directory used by IntelliJ IDEA to store settings and caches
  • 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.

Comment actions Permalink

Please replace text: Type “Windows Security” with: Type “Virus and threat protection”,

because it doesn't work when Windows indexing service is disabled!


Comment actions Permalink

For Malwarebytes Premium users, go to "Settings", then to the "Exclusions" tab, press "Add Exclusion" and add your project directory. 

Comment actions Permalink

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.

Comment actions Permalink

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?

Comment actions Permalink

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.


Comment actions Permalink

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.

Comment actions Permalink

Is it the Defender issue that I have to configure it every time I open IntelliJ project?

Any suggestions how to avoid it?

Edited by Pawel Czech
Comment actions Permalink

Do you mean that AV exclusions do not persist? Could you please file a bug with more details at ?

Comment actions Permalink

@Serge Baranov, I created the issue since

Edited by Pierreloic Pichon
Comment actions Permalink

If what you want is only to ignore all Gradle downloading files once and for all, check my answer here: 

The actual command to run is:(with elevated `cmd`):

powershell -inputformat none -outputformat none -NonInteractive -Command Add-MpPreference -ExclusionPath "%USERPROFILE%\AppData\Local\Temp\gradle_download*"

After doing this, you can change "-ExclusionPath" part to:

 - project folder

 - %userprofile%/.gradle

 - all the folder you want

Edited by Westernguncyber

Please sign in to leave a comment.

Have more questions?

Submit a request