Why does sbt compile fail with StackOverflowError?

后端 未结 8 1263
孤独总比滥情好
孤独总比滥情好 2021-01-31 15:30

I am working on a Scala project that has been in existence for a few years but is new to me. My task is to upgrade it from Scala 2.9.3 to 2.11.7, along with its dependencies. I

8条回答
  •  清歌不尽
    2021-01-31 15:55

    Relevant parts from the output of sbt -h:

      # jvm options and output control
      JAVA_OPTS          environment variable, if unset uses ""
      .jvmopts           if this file exists in the current directory, its contents
                         are appended to JAVA_OPTS
      SBT_OPTS           environment variable, if unset uses ""
      .sbtopts           if this file exists in the current directory, its contents
                         are prepended to the runner args
    

    Thus, in my case I solved the problem by creating a file .sbtopts with content

    -J-Xmx4G 
    -J-Xss4M
    

    in the project directory.

    Note: Running sbt -d shows what settings have been used, for instance:

    $ sbt -d
    [addSbt] arg = '-debug'
    [process_args] java_version = '8'
    # Executing command line:
    java
    -Xms1024m
    -XX:ReservedCodeCacheSize=128m
    -XX:MaxMetaspaceSize=256m
    -Xmx2G
    -Xss2M
    -jar
    /path/to/sbt-launch.jar
    -debug
    

提交回复
热议问题