I ran into this problem when I tried to create the Cloudera Navigator SDK examples. I am using a 32-bit JVM, and the compilation seems to have gone fine, but after that the test failed with this error:
Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap
I tried to set MAVEN_OPTS = -Xmx512m, but that didnβt affect it - it is not with the same message. Even the 2097152KB value in the error message was the same (weird!).
I finally realized that the heap size value was hard-coded for the test in the pom.xml file! He had
<argLine>-Xmx2048m ... </argline>
I edited pom.xml and changed it to -Xmx1024m, and then maven was able to build and test everything without problems.
So, the lesson is that if you are building something provided to you by someone else (e.g. Cloudera) and you get such an error, check pom.xml carefully to check.
Fyi. I think that using a 64-bit JVM could also solve this problem, but I cannot switch to 64-bit. We have something else we need for this to work, and says that it only works with the 32-bit JVM (I can't explain in more detail than here).
Frank K.
source share