I ran into this same issue when I was trying to build the Cloudera Navigator SDK examples. I am using a 32-bit JVM and the compile seemed to go OK but the test afterwards failed with this error:
Error occurred during initialization of VM Could not reserve enough space for 2097152KB object heap
I tried setting MAVEN_OPTS=-Xmx512m but this had no effect- it failed with the same message. Even the value of 2097152KB in the error message was still the same (strange!).
I finally figured out that the heap size value had been hard-coded for the test in the pom.xml file! It had
<argLine>-Xmx2048m ... </argline>
I edited pom.xml and changed that to -Xmx1024m and then maven was able to build and test everything with no problems.
So the lesson from this is that if you are building something given to you by someone else (such as Cloudera) and you get an error like this, check pom.xml carefully to see if the setting is hard-coded in there.
FYI- I think that using a 64-bit JVM might have also possibly resolved this, but I can't switch to 64-bit. We have some other stuff that we need to get this to work with that says that it only works with a 32-bit JVM (I can't really explain in any more detail than that here).
[INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ my-configuration --- [INFO] No tests to run. [INFO] Surefire report directory: C:\target\surefire-reports Error occurred during initialization of VM Could not reserve enough space for object heap Could not create the Java virtual machine.