How to make “test” classes available in the “it” (integration test) configuration?

You can redefine the IntegrationTest Configuration in your project to extend the Test configuration instead of the Runtime Configuration (the default). This will make everything in your test configuration available to your IntegrationTest configuration. import sbt._ import Keys._ object MyBuild extends Build { val scalaTest = “org.scalatest” %% “scalatest” % “2.0” % “test,it” lazy val … Read more

What are key differences between sbt-pack and sbt-assembly?

(Disclaimer: I maintain sbt-assembly) sbt-assembly sbt-assembly creates a fat JAR – a single JAR file containing all class files from your code and libraries. By evolution, it also contains ways of resolving conflicts when multiple JARs provide the same file path (like config or README file). It involves unzipping of all library JARs, so it’s … Read more

How to include an external jar file into the jar with package?

Try this libraryDependencies += “com.acme.common” % “commonclass” % “1.0” from “file:///Users/bwong/git/perf-tools/commonclass/target/scala-2.11/commonclass_2.11-1.0.jar” I “sbt package” the common classproject and then just add that library dependency in my build.sbt in the dependent projects. Thanks to http://flummox-engineering.blogspot.com/2014/06/sbt-use-jar-file-for-librarydependencies.html for this hack.

What is the difference between ThisBuild and Global scopes?

Read Scopes for the full explanation. I’ll quote relevant parts: There are three scope axes: The subproject axis The dependency configuration axis The task axis Scoping by project axis If you put multiple projects in a single build, each project needs its own settings. That is, keys can be scoped according to the project. The … Read more

How to set system properties for runMain on command line?

This works: sbt ‘; set javaOptions += “-Dconfig.resource=../application.conf” ; runMain akka.Main com.my.main.Actor’ If this isn’t a “friendly” enough syntax, wrap it in a little shell script. (Note this assumes you have fork set to true for running. If you don’t, see akauppi’s comment.)

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

Create standalone jar using SBT

There is a difference between standalone and making a project useable as a dependency or another project. In the first case, you would use a plugin such as sbt-assembly. What it will do is create one jar file containing the project class files along with all of its dependencies. If you write an application, what … Read more

How to fix sbt reporting “Error wrapping InputStream in GZIPInputStream: java.io.EOFException”?

It appears that the exception has been due to some problems with the local repo. After cleanup, e.g. removing target directories from ~/.sbt directory it’s now working fine. jacek:~/.sbt $ find . -name target | xargs rm -rf jacek:~/sandbox/stackoverflow/testaaa $ sbt [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Updating {file:/Users/jacek/.sbt/0.13/plugins/}global-plugins… [info] Resolving org.fusesource.jansi#jansi;1.4 … [info] … Read more

How to publish jar to local repository?

The publishLocal action is used to publish your project to a local Ivy repository. By default, this local repository is in ${user.home}/.ivy2/local. You can then use this project from other projects on the same machine source EDIT: Sorry I misread your question. Here is an example to publish a jar or sources to your local … Read more