How to set heap size for sbt?

You need SBT_OPTS, here’s what I use in my .bash_profile: export SBT_OPTS=”-Xmx1536M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M -Duser.timezone=GMT” UPDATE: To get your 2G heap space you can use this: export SBT_OPTS=”-Xmx2G -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=2G -Xss2M -Duser.timezone=GMT” NOTE: SBT MUST BE LATEST VERSION Older versions of sbt contain bugs that override these settings, use brew upgrade sbt … Read more

How to access a secured Nexus with sbt?

Here’s what I did (sbt 0.13 + artifactory – setup should be similar for nexus): 1) Edited the file ~/.sbt/repositories as specified here: http://www.scala-sbt.org/0.13.0/docs/Detailed-Topics/Proxy-Repositories.html [repositories] local my-ivy-proxy-releases: http://repo.company.com/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext] my-maven-proxy-releases: http://repo.company.com/maven-releases/ 2) Locked down my artifactory to disable anonymous access. 3) Created a credentials file in ~/.sbt/.credentials realm=Artifactory Realm host=artifactory.mycompany.com user=username password=password 4) Created a … Read more

how do I get sbt to use a local maven proxy repository (Nexus)?

Step 1: Follow the instructions at Detailed Topics: Proxy Repositories, which I have summarised and added to below: (If you are using Artifactory, you can skip this step.) Create an entirely separate Maven proxy repository (or group) on your corporate Maven repository, to proxy ivy-style repositories such as these two important ones: http://repo.typesafe.com/typesafe/ivy-releases/ http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/ This … Read more

Setting up sbt to use Java 7 for compilation?

The most reliable (perhaps only) way to do this at the moment it to start SBT with java in the JDK7 folder. Modify your sbt launcher script; or use this one that allows you to specify Java Home (and so much more!) as command line options. ~/code/scratch/20111009 sbt -java-home /Library/Java/JavaVirtualMachines/openjdk-1.7-x86_64/Contents/Home Starting sbt: invoke with -help … Read more

How to specify JVM maximum heap size “-Xmx” for running an application with “run” action in SBT?

For forked processes you should look at Build.scala To modify the java options for forked processes you need to specify them in the Build.scala (or whatever you’ve named your build) like this: val buildSettings = Defaults.defaultSettings ++ Seq( //… javaOptions += “-Xmx1G”, //… ) This will give you the proper options without modifying JAVA_OPTS globally, … Read more

How can sbt pull dependency artifacts from git?

You can import unpackaged dependencies into your project from GitHub by treating them as project dependencies, using the dependsOn operator. (This is distinct from the way that precompiled library dependencies are included). Note that you can specify which branch to pull using # notation. Here’s some Scala SBT code that is working well for me: … Read more

How to use sbt from behind proxy?

sbt respects the usual environment variables for http proxy settings: export JAVA_OPTS=”$JAVA_OPTS -Dhttp.proxyHost=yourserver -Dhttp.proxyPort=8080 -Dhttp.proxyUser=username -Dhttp.proxyPassword=password” (That’s of course, assuming Unix (Linux/OSX etc). On windows you could just set the same environment variable (%JAVA_OPTS%) as usual in the Windows way.) Then run sbt as usual: sbt Switching between proxy/no-proxy should be a matter of setting … Read more

How to build an Uber JAR (Fat JAR) using SBT within IntelliJ IDEA?

Finally I totally skip using IntelliJ IDEA to avoid generating noise in my global understanding 🙂 I started reading the official SBT tutorial. I created my project with the following file structure : my-project/project/assembly.sbt my-project/src/main/scala/myPackage/MyMainObject.scala my-project/build.sbt Added the sbt-assembly plugin in my assembly.sbt file. Allowing me to build a fat JAR : addSbtPlugin(“com.eed3si9n” % “sbt-assembly” … Read more

tech