1

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

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

4

1 回答 1

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>

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

于 2017-05-23T12:29:38.830 回答