SBT stop run without exiting

From sbt version 0.13.5 you can add to your build.sbt cancelable in Global := true It is defined as “Enables (true) or disables (false) the ability to interrupt task execution with CTRL+C.” in the Keys definition If you are using Scala 2.12.7+ you can also cancel the compilation with CTRL+C. Reference https://github.com/scala/scala/pull/6479 There are some … Read more

Is there a simple example of how to generate verilog from Chisel3 module?

Thank you for your interest in Chisel! We generally encourage people to use our chisel-template repo as a starting point for Chisel3 projects: https://github.com/ucb-bar/chisel-template If you want to do the most barebones possible thing. Create this build.sbt and put it in the root directory for your project. scalaVersion := “2.13.8” addCompilerPlugin(“edu.berkeley.cs” % “chisel3-plugin” % “3.5.3” … Read more

How do I run an sbt main class from the shell as normal command-line program?

Here’s what I have in my SBT (version 0.10) project definition, val Mklauncher = config(“mklauncher”) extend(Compile) val mklauncher = TaskKey[Unit](“mklauncher”) val mklauncherTask = mklauncher <<= (target, fullClasspath in Runtime) map { (target, cp) => def writeFile(file: File, str: String) { val writer = new PrintWriter(file) writer.println(str) writer.close() } val cpString = cp.map(_.data).mkString(“:”) val launchString = … Read more

assembly-merge-strategy issues using sbt-assembly

As for the current version 0.11.2 (2014-03-25), the way to define the merge strategy is different. This is documented here, the relevant part is: NOTE: mergeStrategy in assembly expects a function, you can’t do mergeStrategy in assembly := MergeStrategy.first The new way is (copied from the same source): mergeStrategy in assembly <<= (mergeStrategy in assembly) … Read more

Spark2.1.0 incompatible Jackson versions 2.7.6

Spark 2.1.0 contains com.fasterxml.jackson.core as transitive dependency. So, we do not need to include then in libraryDependencies. But if you want to add a different com.fasterxml.jackson.core dependencies’ version then you have to override them. Like this: name := “testSpark2” version := “1.0” scalaVersion := “2.11.8” dependencyOverrides += “com.fasterxml.jackson.core” % “jackson-core” % “2.8.7” dependencyOverrides += “com.fasterxml.jackson.core” … Read more

How to reference external sbt project from another sbt project?

You can do a source dependency on your project like that : lazy val core = RootProject(file(“../CoreLibrary”)) val main = Project(id = “application”, base = file(“.”)).dependsOn(core) I have a working example with a multimodule play build : https://github.com/ahoy-jon/play2MultiModule/blob/master/playapp/project/Build.scala But I think the proper way (it depends of your context) of doing it is to create … Read more

How to exclude commons-logging from a scala/sbt/slf4j project?

Heiko’s approach will probably work, but will lead to none of the dependencies of the 3rd party lib to be downloaded. If you only want to exclude a specific one use exclude. libraryDependencies += “foo” % “bar” % “0.7.0” exclude(“org.baz”, “bam”) or … excludeAll( ExclusionRule(organization = “org.baz”) ) // does not work with generated poms!