scalamavenstack-size

increase scala stack size during maven build


While compiling a scala project using maven (mvn compile) , I am getting error: java.lang.StackOverflowError. I got the same from eclipse as well, but could solve it by giving Additional command line parameters: -J-Xss256m for scala compiler , as given here How to increase scala stack size

But I am getting the same error while doing "mvn compile". How can I solve this ? Basically how to increase scala stack size while building via maven


Solution

  • You can configure the scala-maven-plugin in the pom.xml like bellow

    <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>
    

    For more see http://davidb.github.io/scala-maven-plugin/example_compile.html