前言
技术栈
Windows 10Java/JDK 1.8.0_202Maven 3.6.3spark 2.4.6scala 2.12hadoop 2.6.0-cdh5.10.0
- 操作系统中并没有装置 scala,利用 pom.xml 中的插件编译 scala 代码
报错景象
编译命令
mvn -D maven.test.skip=true clean scala:compile compile package
报如下谬误
......[ERROR] error: java.lang.StackOverflowError......[INFO] at scala.tools.nsc.javac.JavaScanners$JavaScanner.skipBlockComment(JavaScanners.scala:585)[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------[INFO] Total time: 12.495 s[INFO] Finished at: 2023-03-20T13:56:52+08:00[INFO] ------------------------------------------------------------------------[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.4.6:compile (default-cli) on project DataAnalysis_aws_smartlib: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: -10000 (Exit value: -10000) -> [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
解决办法
给编译插件增加 jvm 参数
jvmArg
,增加后scala-maven-plugin
插件残缺配置如下<plugin> <groupId>net.alchim31.maven</groupId> <artifactId>scala-maven-plugin</artifactId> <version>3.4.6</version> <executions> <execution> <id>scala-compile-first</id> <phase>process-resources</phase> <goals> <goal>add-source</goal> <goal>compile</goal> </goals> </execution> </executions> <configuration> <jvmArgs> <!-- 指定 scala 编译时栈大小 --> <jvmArg>-Xss4m</jvmArg> </jvmArgs> <scalaVersion>${scala.version}</scalaVersion> </configuration></plugin>
scala-maven-plugin
插件 GitHub 地址:https://github.com/davidB/scala-maven-plugin
相干浏览
JVM 参数及默认值
-Xms指定jvm堆的初始大小,默认为物理内存的1/64,最小为1M;能够指定单位,比方k、m,若不指定,则默认为字节。-Xmx指定jvm堆的最大值,默认为物理内存的1/4或者1G,最小为2M;单位与-Xms统一。-Xss设置单个线程栈的大小,个别默认为512k。
本文出自 qbit snap