What does the MAVEN_OPTS environment variable do?

After going through above comments, I clarify my doubts about MAVEN_OPTS and maven semantics. The MAVEN_OPTS environment variable contains parameters used to start up the JVM running Maven and can be used to supply additional options. This includes JVM memory pool parameters. Kindly refer this link and go through the document.

    -Xmsn
            Specifies the initial size, in bytes, of the memory allocation pool. This value 
must be a multiple of 1024 greater than 1 MB. Append the letter k or K to indicate kilobytes,
 or m or M to indicate megabytes. The default value is chosen at runtime based on system configuration. See Garbage Collector Ergonomics at
            [http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html][2]
            
            Examples:
            
            -Xms6291456
            -Xms6144k
            -Xms6m
    
      -Xmxn
            Specifies the maximum size, in bytes, of the memory allocation pool. This value 
must a multiple of 1024 greater than 2 MB. Append the letter k or K to indicate kilobytes, or m
 or M to indicate megabytes. The default value is chosen at runtime based on system 
configuration.
            
            For server deployments, -Xms and -Xmx are often set to the same value. See Garbage
 Collector Ergonomics at
            [http://docs.oracle.com/javase/7/docs/technotes/guides/vm/gc-ergonomics.html][3]
            
            Examples:
            
            -Xmx83886080
            -Xmx81920k
            -Xmx80m

Documentation is great but it is not always complete. There are some additional things which you can do to figure things out yourself. In this case you know that MAVEN_OPTS is an environmental variable, which likely means it is used in shell script. So open up for example mvn.bat and search for MAVEN_OPTS to see how it is used.

You will find it is simply a way to specify Java command line arguments which will be in effect for the execution of Maven itself. As an example in the past I needed to increase the default permgen size to prevent issues during execution of a complex build.

Tags:

Java

Maven