在 Maven 构建期间增加 scala 堆栈大小

use*_*284 1 scala stack-size maven

使用 maven (mvncompile) 编译 scala 项目时,出现错误:java.lang.StackOverflowError。我也从 Eclipse 中得到了相同的结果,但可以通过提供附加命令行参数来解决它: -J-Xss256m for scala compiler ,如此处给出的How to raise scala stack size

但我在执行“mvn编译”时遇到同样的错误。我该如何解决这个问题?基本上如何在通过 Maven 构建时增加 scala 堆栈大小

Ste*_*hen 5

pom.xml您可以像下面这样配置 scala-maven-plugin

<project>
  ...
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <version>3.2.1</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <jvmArgs>
            <jvmArg>-Xms256m</jvmArg>
            <jvmArg>-Xmx1024m</jvmArg>
          </jvmArgs>
        </configuration>
      </plugin>
  ...
</project>
Run Code Online (Sandbox Code Playgroud)

有关更多信息,请参阅http://davidb.github.io/scala-maven-plugin/example_compile.html