我已经编写了一个 Java Spring-WS-Application 服务器,并尝试使用 maven 从命令行部署它。但是,当尝试执行“mvn clean package”时,它告诉我由于堆空间不足而无法创建 Java 虚拟机。我的电脑只有 4GB 的 RAM,而且运行的是 32 位 Windows。只要我包含 -DskipTests,部署就会成功。
这个项目依赖于我的团队编写的其他项目,我可以使用“mvn clean install”毫无问题地部署它们。我也可以毫无问题地部署其他服务器,所以我认为我的 java 版本没有损坏。此外,我的开发团队的其他成员已经能够在他们的机器上成功地部署这个服务器。
我还检查并注释了所有 @Test 注释以尝试查找错误测试,但是当没有要运行的测试时它仍然给我这个错误。
关于为什么会发生这种情况的任何想法?
爪哇版:
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
“mvn clean package:”的结果
C:\workspace\My-Project>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building My Project Spring-WS Application 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ my-project ---
[INFO] Deleting C:\workspace\My-Project\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ my-project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\workspace\My-Project\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.0:compile (default-compile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 49 source files to C:\workspace\My-Project\target\classes
[WARNING] Note: C:\workspace\My-Project\src\main\java\my\package\of\doom\impl\classImpl.java uses or overrides a
deprecated API.
[WARNING] Note: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ my-project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.0:testCompile (default-testCompile) @ my-project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 25 source files to C:\workspace\My-Project\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.14:test (default-test) @ my-project ---
[INFO] Surefire report directory: C:\workspace\My-Project\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Error occurred during initialization of VM
Could not create the Java virtual machine.
Could not reserve enough space for object heap
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.783s
[INFO] Finished at: Thu Jun 13 09:01:15 EDT 2013
[INFO] Final Memory: 14M/54M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test (default-test) on project my-pro
ject: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.14:test failed: The fo
rked VM terminated without saying properly goodbye. VM crash or System.exit called ?
[ERROR] Command wascmd.exe /X /C "C:\Oracle2\Middleware\jdk160_24\jre\bin\java -Xms512m -Xmx1024m -XX:MaxPermSize=512m -
jar C:\workspace\My-Project\target\surefire\surefirebooter4008500116671254841.jar C:\workspace\My-Project\target\surefir
e\surefire8598565507069545685tmp C:\workspace\My-Project\target\surefire\surefire_07977292658698847040tmp"
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
Eclipse.ini:
-vm
C:/Oracle2/Middleware/jdk160_24/bin/javaw
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-showsplash
org.eclipse.platform
--launcher.defaultAction
openFile
-vmargs
-Xms512m
-Xmx1024m
-XX:MaxPermSize=512m
-Dsun.lang.ClassLoader.allowArraySyntax=true