Play 2.3.6 Java - OutOfMemory errors w/ sbt-uglify

2019-07-25 06:34发布

I'm having an issue when trying to use the sbt-uglify plugin. I've configured the project per: https://github.com/sbt/sbt-uglify

in plugins.sbt:

addSbtPlugin("com.typesafe.sbt" % "sbt-uglify" % "1.0.3")

in build.sbt:

pipelineStages := Seq(uglify, digest, gzip)

I have a non-trivial number of JS files (60+). What I've been getting is an OutOfMemory exception which prevents me from being able to complete a dist command.

Has anyone else encountered this problem? Any ideas/solutions are appreciated.

(NOTE: I've tried bumping up my SBT_OPTS without success already).

Thanks!

1条回答
做自己的国王
2楼-- · 2019-07-25 07:03

I suppose you really are running out of memory. I don't know whether or not the plugin is cuasing it, but you can limit the memory Java asks for.

Have you tried setting the Xmx or Xms options for Java?

If you know your memory limit on your machine, you can easily set those options. Let's just say you have 1GB of memory available, we'll set the max heap size for Java to 512MB, temporarily using _JAVA_OPTIONS, which is picked up by Play Framework:

export _JAVA_OPTIONS="-Xms256m -Xmx512m"

Then you can try running the dist command. It should immediately print out that the Java Options were picked up.

查看更多
登录 后发表回答