stackoverflowerror
ERROR:scalac:
while compiling: E:\XXXXXXXXX.scala
during phase: erasure
library version: version 2.10.4
compiler version: version 2.10.4
reconstructed args: -classpath F:\BaiduNetdiskDownload\jdk1.7.0_55\jre\lib\charsets.jar;F:\BaiduNetdiskDownload\jdk1.7.0_55\jre\lib\deploy.jar;F:\BaiduNetdiskDownload\jdk1.7.0_55\jre\lib\ext\access-bridge-64.jar;.................
last tree to typer: TypeTree(class String)
symbol: class String in package lang (flags: final <java>)
symbol definition: final class String extends serializable with Comparable[String] with Charsequence
tpe: String
symbol owners: class String -> package lang
context owners: method payBase -> object XXX-> package revenue
== Enclosing template or block ==
APPly( // def <init>(parts: Seq[String]): StringContext in class StringContext
new StringContext."<init>" // def <init>(parts: Seq[String]): StringContext in class StringContext
Apply( // implicit def wrapRefArray[T <: Object](xs: Array[T]): scala.collection.mutable.WrappedArray[T] in class LowpriorityImplicits
scala.this."Predef"."wrapRefArray" // implicit def wrapRefArray[T <: Object](xs: Array[T]): scala.collection.mutable.WrappedArray[T] in class LowPriorityImplicits
ArrayValue(
<tpt> // tree.tpe=String
List(
"INSERT OVERWRITE TABLE XXXXXXXXX PARTITION(STATDATE,datasource) "
)
)
)
)
== Expanded type of tree ==
TypeRef(
typesymbol(
final class String extends Serializable with Comparable[String] with CharSequence
)
)
uncaught exception during compilation: java.lang.stackoverflowerror
java7开始,字符串常量池被移到了Heap空间,Heap空间的大小只受制于机器的真实内存大小,因此,在Java7下使用String.intern()能更有效地减少重复String对象对内存的占用。
参考:https://blog.csdn.net/u014600432/article/details/50983741
参考:https://blog.csdn.net/kl28978113/article/details/53031710
解决方式:
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.7</arg>
</args>
<!-- jdk7开始字符串常量池被移到了Heap空间,字符串太多要注意uncaught exception during compilation: java.lang.StackOverflowError -->
<jvmArgs>
<jvmArg>-Xss20480K</jvmArg>
</jvmArgs>
</configuration>
</plugin>
然后这里可能出现Java和Scala混用不知道先编译谁的问题,参考https://davidb.github.io/scala-maven-plugin/example_java.html 我试了没成功,然后我直接将一堆字符串+号连接的换成了三引号加
stripMargin作为一个字符串就好了,也不用插件了;