[ERROR] Failure executing javac, but could not parse the error: [ERROR] java

maven 打包编译异常
Compilation failure
Failure executing javac, but could not parse the error:
编译器 (1.6.0_21) 中出现异常。 
java.nio.BufferOverflowException
解决方案:
1、设置内存占用大小:MAVEN_OPTS=-Xmx512m。
2、设置编译编码
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<!-- 增加字符编码, 要与项目编码一致 -->
<encoding>UTF-8</encoding>
</configuration>
</plugin>

可能原因是由于字符集不统一,使用GBK、UTF-8或者UTF-16导致使用多字节存放字符,内存使用增加,堆(heap)的尺寸无法提供程序所需的空间,造成异常。更深入的分析还在进行中。

猜你喜欢

转载自xdjava.iteye.com/blog/1718662