Maven compiles Scala and reports an error stackoverflowerror

Error during Maven compilation: java.lang.stackoverflowerror

preface

Most of this error is caused by the java thread stack, but it is not caused by this reason. I don’t know if I’ve heard of [in scala-2.10. X version, when there are more than 22 elements of case class, an error will be reported after compilation]. I really do this because there are more than 130 member variables in a case class, But mine is Scala_ 2.11 so I don’t think the problem is caused by the version. During the experiment, when the membership is limited to about 100, it’s OK. Of course, I’m lazy to disassemble the case class

Online solution (my solution)

Another problem on the Internet is to solve my problem. This method is to add the configuration parameters directly to the POM file

<plugin>
    <groupId>net.alchim31.maven</groupId>
    <artifactId>scala-maven-plugin</artifactId>
    <version>3.4.0</version>
    
    <!-- Add-->
    <configuration>
        <displayCmd>true</displayCmd>
        <jvmArgs>
            <jvmArg>-Xss20m</jvmArg>
        </jvmArgs>
    </configuration>
    
    
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
                <goal>testCompile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Read More: