sbt

how to shade before compile with SBT?

自古美人都是妖i 提交于 2019-12-30 08:19:40
问题 Our project mainly consists of two parts Build.scala where the root project lies BuildShaded.scala where some external dependencies are shaded with sbt-assembly. The shaded jars will be depended upon by sub projects under the root project through unmanagedJars setting. The question is how to assembly the shaded project before compiling the root project. Otherwise, the root project will fail to compile since those classes in the shaded jars are not available. 回答1: As I said in the comments, I

What is a classifier in SBT

回眸只為那壹抹淺笑 提交于 2019-12-30 08:10:09
问题 What is meant under the term classifiers ? Is it comes from Jars? For example in sbt-assembly plugin: artifact in (Compile, assembly) ~= { art => art.copy(`classifier` = Some("assembly")) } 回答1: classifier is defined by Maven as the fifth element of a project coordinate, after groupId , artifactId , version and packaging . More specifically (from the maven documentation, emphasis mine): The classifier allows to distinguish artifacts that were built from the same POM but differ in their

How to copy some files to the build target directory with SBT?

余生颓废 提交于 2019-12-30 06:23:25
问题 How can I copy some source files (e.g. /src/main/html/*.html ) to the build output directory (e.g. /target/scala-2.11/ ) with SBT so that the files end up in the target root and not in the classes subdirectory (which is what happens if I add the source directory to unmanagedResourceDirectories )? 回答1: You can define sbt task copying resources to target directory: lazy val copyRes = TaskKey[Unit]("copyRes") lazy val root:Project = Project( ... ) .settings( ... copyRes <<= (baseDirectory,

How to run sbt as daemon?

你离开我真会死。 提交于 2019-12-30 06:04:27
问题 I've tried nohup "sbt run" & returns : nohup: failed to run command ‘sbt run’: No such file or directory and tried : nohup sbt run & [2] 7897 # nohup: ignoring input and appending output to ‘nohup.out’ When I carriage return expecting process to continue running I receive : [2]+ Stopped nohup sbt run How to run sbt as a daemon ? Update : sbt run </dev/null & [5] 8961 I think cd up one dir : # cd .. [5]+ Stopped sbt run < /dev/null (wd: /home/sum) (wd now: /home) So it starts as daemon but if

How to format the sbt build files with scalariform automatically?

点点圈 提交于 2019-12-30 04:16:09
问题 I'd like to format my sbt build files with scalariform. Is it possible to run scalariform on the build definition itself when starting sbt? 回答1: Put this in project/scalariform.sbt : addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.2.0") And this in scalariform.sbt : import scalariform.formatter.preferences._ import ScalariformKeys._ lazy val BuildConfig = config("build") extend Compile lazy val BuildSbtConfig = config("buildsbt") extend Compile val foo: Int => Int = { case 1 => 1

Where is sbt inside Typesafe Activator?

穿精又带淫゛_ 提交于 2019-12-30 01:41:26
问题 I am trying out the Play Framework 2.3.2 using the offline installation with Typesafe Activator 1.2.3. Every piece of documentation tells me that it's using sbt under the covers to build and run projects. Where is this sbt located/installed? Is it somewhere in the unzipped folder that contained the Activator installation? How do I start sbt from command line? It's not on the PATH as running locate sbt finds nothing. 回答1: The activator-launcher-<version>.jar is actually the sbt launcher with

How to pass command line args to program in SBT 0.13.1?

女生的网名这么多〃 提交于 2019-12-29 08:31:41
问题 I just switched to SBT 0.13.1 and either arg handling changed or there's a bug. Here's what I'm testing with (named sbt-test.scala ): #!/bin/sh SBT_0_13_0="/path/to/sbt-launch-0.13.0.jar" SBT_0_13_1="/path/to/sbt-launch-0.13.1.jar" SBT="$SBT_0_13_1" exec java $JAVA_OPTS -Dsbt.main.class=sbt.ScriptMain -jar "$SBT" $0 "$@" !# /*** scalaVersion := "2.10.3" libraryDependencies ++= Seq( "com.typesafe" % "config" % "1.0.0" ) */ import com.typesafe.config.{ConfigFactory, Config} println(s"Args: $

Why does sbt fail with NoClassDefFoundError: play/Play$ in Play 2.2.x projects after sbt compile in Play 2.3 project?

懵懂的女人 提交于 2019-12-29 06:43:06
问题 Once I run 'sbt compile' on a 2.3 play project, I can't use 'sbt compile' to compile any Play 2.2.x projects anymore. This is the error when I run sbt command. [info] Loading project definition from /Users/macbookpro/playproject/project [error] java.lang.NoClassDefFoundError: play/Play$ [error] Use 'last' for the full log. Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? 回答1: I just had this same issue. In my case I was using Play 2.4, but it's probably the same cause. I had run

Multiple executable jar files with different external dependencies from a single project with sbt-assembly

痞子三分冷 提交于 2019-12-29 03:53:09
问题 I have a single scala project built with sbt using a build.scala file. I can use sbt-assembly to generate a single executable jar file from this project without problem. Now I want to generate multiple executable jar files, where each file includes a common set of internal and external base dependencies along with different external dependencies . Is this possible with the current version of sbt-assembly? In maven this is easy, as one can define multiple profiles in the pom, each generating a

SBT 0.13.11 cannot download dependencies behind a proxy

ε祈祈猫儿з 提交于 2019-12-28 06:54:08
问题 Using Windows 7, 64bit, behind a proxy server. I have downloaded and installed the latest versions of SBT(0.13.11), Scala(2.11.8), and IntelliJ IDEA Community(2016.1.2). When I try to start a new project in IntelliJ, the newest version of SBT I can use is 0.13.8, not 0.13.11. Does anyone know why this might be? If I try to start a new project I get an error: Error:Error while importing SBT project: ... [warn] :: UNRESOLVED DEPENDENCIES :: [warn] ::::::::::::::::::::::::::::::::::::::::::::::