mvn clean install
在 android 项目上执行时收到内存不足错误。
下面是我的pom文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.jr.main</groupId>
<artifactId>AndroidMyHomeV2</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>App</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<!-- Make sure this is below the android dependencies -->
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>robolectric</artifactId>
<version>2.2-SNAPSHOT</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.holoeverywhere</groupId>
<artifactId>slidingmenu</artifactId>
<version>1.4.2</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>org.holoeverywhere</groupId>
<artifactId>library</artifactId>
<version>1.4.2</version>
<type>apklib</type>
</dependency>
<dependency>
<groupId>com.nineoldandroids</groupId>
<artifactId>library</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.restlet.jse</groupId>
<artifactId>org.restlet</artifactId>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.4.0</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<sdk>
<!-- platform or api level (api level 16 = platform 4.1) -->
<platform>18</platform>
<path>/Users/me/android-sdk-macosx</path>
</sdk>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
<dex>
<jvmArguments>
<jvmArgument>-Xms1024m</jvmArgument>
<jvmArgument>-Xmx1024m</jvmArgument>
</jvmArguments>
</dex>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<excludes>
<exclude>**/Test*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>allow-snapshots</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>maven-restlet</id>
<name>Public online Restlet repository</name>
<url>http://maven.restlet.org</url>
</repository>
</repositories>
</profile>
</profiles>
</project>
这是错误的完整堆栈跟踪:
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.ibex.nestedvm.UnixRuntime$ResourceFS$2) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO] warning: Ignoring InnerClasses attribute for an anonymous inner class
[INFO] (org.ibex.nestedvm.util.Sort$1) that doesn't come with an
[INFO] associated EnclosingMethod attribute. This class was probably produced by a
[INFO] compiler that did not target the modern .class file format. The recommended
[INFO] solution is to recompile the class from source, using an up-to-date compiler
[INFO] and without specifying any "-target" type options. The consequence of ignoring
[INFO] this warning is that reflective operations on this class will incorrectly
[INFO] indicate that it is *not* an inner class.
[INFO]
[INFO] UNEXPECTED TOP-LEVEL ERROR:
[INFO] java.lang.OutOfMemoryError: Java heap space
[INFO] at java.util.ArrayList.<init>(ArrayList.java:112)
[INFO] at java.util.ArrayList.<init>(ArrayList.java:119)
[INFO] at com.android.dx.ssa.Dominators$DFSInfo.<init>(Dominators.java:282)
[INFO] at com.android.dx.ssa.Dominators$DfsWalker.visitBlock(Dominators.java:259)
[INFO] at com.android.dx.ssa.SsaMethod.forEachBlockDepthFirst(SsaMethod.java:784)
[INFO] at com.android.dx.ssa.Dominators.run(Dominators.java:185)
[INFO] at com.android.dx.ssa.Dominators.make(Dominators.java:90)
[INFO] at com.android.dx.ssa.DomFront.run(DomFront.java:90)
[INFO] at com.android.dx.ssa.SsaConverter.placePhiFunctions(SsaConverter.java:298)
[INFO] at com.android.dx.ssa.SsaConverter.convertToSsaMethod(SsaConverter.java:52)
[INFO] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:99)
[INFO] at com.android.dx.ssa.Optimizer.optimize(Optimizer.java:73)
[INFO] at com.android.dx.dex.cf.CfTranslator.processMethods(CfTranslator.java:273)
[INFO] at com.android.dx.dex.cf.CfTranslator.translate0(CfTranslator.java:134)
[INFO] at com.android.dx.dex.cf.CfTranslator.translate(CfTranslator.java:87)
[INFO] at com.android.dx.command.dexer.Main.processClass(Main.java:487)
[INFO] at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
[INFO] at com.android.dx.command.dexer.Main.access$400(Main.java:67)
[INFO] at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:245)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:131)
[INFO] at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
[INFO] at com.android.dx.command.dexer.Main.processOne(Main.java:422)
[INFO] at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
[INFO] at com.android.dx.command.dexer.Main.run(Main.java:209)
[INFO] at com.android.dx.command.dexer.Main.main(Main.java:174)
[INFO] at com.android.dx.command.Main.main(Main.java:91)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3:08.673s
[INFO] Finished at: Mon Sep 02 12:01:56 BST 2013
[INFO] Final Memory: 19M/116M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.6.1:dex (default-dex) on project AndroidMyHomeV2: MojoExecutionException: ANDROID-040-001: Could not execute: Command = /bin/sh -c cd /Users/Jonathan/git/AndroidMyHomeV2 && /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java -Xms1024m -Xmx1024m -jar /Users/Jonathan/android-sdk-macosx/build-tools/18.0.0/lib/dx.jar --dex --output=/Users/Jonathan/git/AndroidMyHomeV2/target/classes.dex /Users/Jonathan/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar /Users/Jonathan/.m2/repository/org/apache/maven/wagon/wagon-provider-api/1.0-beta-6/wagon-provider-api-1.0-beta-6.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-artifact/2.2.1/maven-artifact-2.2.1.jar /Users/Jonathan/.m2/repository/org/holoeverywhere/library/1.4.2/library-1.4.2.apklib /Users/Jonathan/.m2/repository/org/codehaus/plexus/plexus-container-default/1.0-alpha-9-stable-1/plexus-container-default-1.0-alpha-9-stable-1.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-error-diagnostics/2.2.1/maven-error-diagnostics-2.2.1.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-profile/2.2.1/maven-profile-2.2.1.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-artifact-manager/2.2.1/maven-artifact-manager-2.2.1.jar /Users/Jonathan/.m2/repository/com/nineoldandroids/library/2.4.0/library-2.4.0.jar /Users/Jonathan/.m2/repository/org/ow2/asm/asm-tree/4.1/asm-tree-4.1.jar /Users/Jonathan/git/AndroidMyHomeV2/target/classes /Users/Jonathan/.m2/repository/com/actionbarsherlock/actionbarsherlock/4.4.0/actionbarsherlock-4.4.0.apklib /Users/Jonathan/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar /Users/Jonathan/.m2/repository/org/apache/httpcomponents/httpcore/4.0.1/httpcore-4.0.1.jar /Users/Jonathan/.m2/repository/org/ow2/asm/asm/4.1/asm-4.1.jar /Users/Jonathan/.m2/repository/org/osgi/org.osgi.core/4.0.0/org.osgi.core-4.0.0.jar /Users/Jonathan/.m2/repository/org/apache/maven/wagon/wagon-http-lightweight/1.0-beta-6/wagon-http-lightweight-1.0-beta-6.jar /Users/Jonathan/.m2/repository/org/apache/maven/wagon/wagon-file/1.0-beta-6/wagon-file-1.0-beta-6.jar /Users/Jonathan/.m2/repository/org/ow2/asm/asm-commons/4.1/asm-commons-4.1.jar /Users/Jonathan/.m2/repository/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar /Users/Jonathan/.m2/repository/nekohtml/xercesMinimal/1.9.6.2/xercesMinimal-1.9.6.2.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar /Users/Jonathan/.m2/repository/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar /Users/Jonathan/.m2/repository/org/robolectric/robolectric/2.2-SNAPSHOT/robolectric-2.2-SNAPSHOT-jar-with-dependencies.jar /Users/Jonathan/.m2/repository/org/objenesis/objenesis/1.3/objenesis-1.3.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-ant-tasks/2.1.3/maven-ant-tasks-2.1.3.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-plugin-registry/2.2.1/maven-plugin-registry-2.2.1.jar /Users/Jonathan/.m2/repository/org/apache/httpcomponents/httpclient/4.0.1/httpclient-4.0.1.jar /Users/Jonathan/.m2/repository/com/google/android/support-v4/r7/support-v4-r7.jar /Users/Jonathan/.m2/repository/org/restlet/jse/org.restlet/2.0.0/org.restlet-2.0.0.jar /Users/Jonathan/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar /Users/Jonathan/.m2/repository/com/ximpleware/vtd-xml/2.11/vtd-xml-2.11.jar /Users/Jonathan/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar /Users/Jonathan/.m2/repository/org/easytesting/fest-reflect/1.4.1/fest-reflect-1.4.1.jar /Users/Jonathan/.m2/repository/org/apache/ant/ant/1.8.0/ant-1.8.0.jar /Users/Jonathan/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar /Users/Jonathan/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar /Users/Jonathan/.m2/repository/org/apache/maven/wagon/wagon-http-shared/1.0-beta-6/wagon-http-shared-1.0-beta-6.jar /Users/Jonathan/.m2/repository/org/ow2/asm/asm-analysis/4.1/asm-analysis-4.1.jar /Users/Jonathan/.m2/repository/org/easytesting/fest-util/1.2.5/fest-util-1.2.5.jar /Users/Jonathan/.m2/repository/org/ow2/asm/asm-util/4.1/asm-util-4.1.jar /Users/Jonathan/.m2/repository/nekohtml/nekohtml/1.9.6.2/nekohtml-1.9.6.2.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-project/2.2.1/maven-project-2.2.1.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-model/2.2.1/maven-model-2.2.1.jar /Users/Jonathan/.m2/repository/org/holoeverywhere/slidingmenu/1.4.2/slidingmenu-1.4.2.apklib /Users/Jonathan/.m2/repository/org/xerial/sqlite-jdbc/3.7.2/sqlite-jdbc-3.7.2.jar /Users/Jonathan/.m2/repository/org/apache/maven/maven-repository-metadata/2.2.1/maven-repository-metadata-2.2.1.jar, Result = 3 -> [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/MojoExecutionException
不知道为什么我会收到此错误。