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