Maven import in Intellij IDEA runs out of memory on a large project

24,608

Solution 1

The solution is to set -Xmx1g (or more) in Maven VM options for importer (yes, it is a separate option!). Go to "Settings/Preferences -> Build Tools -> Maven -> Importing", and find the option there.

Maven importing settings

Read more on JVM heap size: (Q) What are the Xms and Xmx parameters when starting JVMs?.

Solution 2

enter image description here

if you want in idea, this config will be success. "Build process heap size (Mbytes)"

preference->Build,Execution,Deployment->Compiler:Build process heap size (Mbytes)

Share:
24,608

Related videos on Youtube

naXa stands with Ukraine
Author by

naXa stands with Ukraine

#BelarusWithUkraine 🀍❀️🀍 πŸ‡ΊπŸ‡¦ I focus mostly on java technologies such as spring-framework, android, hibernate, gradle, etc. Employment history: Exadel, ScienceSoft, self-employed. Feel free to consider all code I provide on Stack Overflow licensed under CC0, I would be happy to receive an "honourable mention" or something, but for the code it's optional.

Updated on June 15, 2020

Comments

  • naXa stands with Ukraine
    naXa stands with Ukraine about 4 years

    Import of Maven project ends with

    Exception java.lang.OutOfMemoryError: GC overhead limit exceeded
    
    1. I've tried to define an environment variable: MAVEN_OPTS = -Xmx1g.
    2. I've tried to add -Xmx1g to Maven VM options via Settings -> Build Tools -> Maven -> Runner.

    Without success. What else can I do?

  • naXa stands with Ukraine
    naXa stands with Ukraine over 6 years
    If increasing memory limit doesn't help, check idea.log (how to find logs?) for errors related to Maven importing.
  • Wangshen Bi
    Wangshen Bi about 6 years
    preference->Build,Execution,Deployment->Compiler:Build process heap size (Mbytes)
  • sarthakgupta072
    sarthakgupta072 about 5 years
    Go to Preferences (on Mac) instead of Settings. :)
  • R11G
    R11G over 4 years
    Can -Xmx be set to 16384?
  • naXa stands with Ukraine
    naXa stands with Ukraine over 4 years
    @R11G yes, you can set it to 16384, but note that 16384 bytes are just 16 kilobytes. set it to 16384k if you want 16 megabytes, or 16384m if you want 16 gigabytes.