FAQ Database Discussion Community


sbt modify the lib output directory when using sbt-native-packager

sbt,sbt-native-packager
How can I modify the output of the final packaged zip to move the "lib" directory contents up one level. Basically I output a zip and the contents are like so: ZIP FILE CONTENT: -- my-plugin-1.0.jar -- /lib -- /lib/mydependency1.jar -- /lib/mydependency2.jar ZIP FILE CONTENT I WISH TO HAVE: --...

sbt-dependency-graph equivalent for inter-project dependencies

sbt
Is there's a sbt-dependency-graph equivalent for inter-project dependencies (ie. projectA dependsOn projectB)? Either as an sbt plugin or using sbt internals.

Scala program isn't seeing dependencies downloaded via SBT

scala,sbt,spark-cassandra-connector
I'm writing a script to try to get Cassandra and Spark working together but I can't even get the program to compile. I am using SBT as the build tool and I have all the dependencies required for the program declared. The first time I ran sbt run it downloaded...

android-sdk-plugin project doesn't know about Android classes

android,scala,sbt,android-sdk-plugin
I have Ubuntu 15.04 64 bit, Scala 2.11.6 and sbt 0.13.8. I have android-sdk installed with at least android-22, and ANDROID_HOME set properly. I followed the "Usage" section in android-sdk-plugin and did the following: Created a fresh directory with the following files: build.sbt: lazy val root = (project in file...

Spark - “sbt package” - “value $ is not a member of StringContext” - Missing Scala plugin?

scala,intellij-idea,apache-spark,sbt
When running "sbt package" from the command line for a small Spark Scala application, I'm getting the "value $ is not a member of StringContext" compilation error on the following line of code: val joined = ordered.join(empLogins, $"login" === $"username", "inner").orderBy($"count".desc).select("login", "count") Intellij 13.1 is giving me the same error...

Scala Unicode Syntax

scala,unicode,intellij-idea,sbt
I know that these two are equivalent in Scala: for {x <- xs} yield x case Nil => println("foo") Note the Unicode replacement for <- and =>: for {x ← xs} yield x case Nil ⇒ println("foo") What is this feature called? I googled various combinations of "Scala Unicode Operators/Symbols"...

Preprocessing of sbt-twirl templates

scala,sbt,twirl
I need to preprocess some Twirl templates in my sbt project. Is it possible to define a task in build.sbt that will run before Twirl plugin compiles its templates?

Different sbt-web pipeline task settings in development vs production?

playframework,sbt,playframework-2.3,uglifyjs,sbt-web
I would like an sbt setting to have a different value when running in development (sbt run) than production (sbt dist / sbt start). Specifically I am using sbt-uglify. I use it in development to concatenate javascript assets into one file. I have compression and mangling disabled in development because...

How to include a jar file into scala code [duplicate]

java,scala,jar,sbt
This question already has an answer here: How to make a jar file from scala 3 answers This is the scala code that I have written object Main extends App { println("Hello World from Scala!") } This is my build file name := "hello-world" version := "1.0" scalaVersion :=...

Add timestamp to zip created by sbt-native-packager

playframework,sbt,sbt-native-packager
Would it be possible to append a timestamp to the generated zip's filename you get when executing the dist command? Lets say my project name is "backend", and the current dev version is 0.2.3-SNAPSHOT. What I would like to do is execute the dist command and get a file called...

SBT PublishM2 do not refresh snapshot jar in local maven repo

scala,maven,sbt
I have a simple Sbt project name := "xxxx" organization := "xxxxx" version := "0.0.2-SNAPSHOT" scalaVersion := "2.11.6" resolvers += "spray repo" at "http://repo.spray.io" scalacOptions in ThisBuild ++= Seq("-language:postfixOps", "-feature") libraryDependencies ++= Seq("io.spray" %% "spray-client" % "1.3.3", "io.spray" %% "spray-json" % "1.3.2", "com.typesafe.akka" %% "akka-actor" % "2.3.11", "org.dspace" % "dspace-api"...

How to handle versions of sbt, scala, libraries

scala,sbt,version
When playing with something in Scala, I typically spend a bunch of time trying combinations of dependency versions, Scala versions, %% vs %, etc. And when it starts working, I am not quite sure why, or for how long... It would be great if someone could explain the Scala ecosystem's...

Play cannot resolve MySQL Driver

java,playframework,sbt,playframework-2.4
I just upgraded to Play 2.4 and for whatever reason I'm unable to load up the JDBC MySQL driver. Here is what I have in build.sbt libraryDependencies ++= Seq( javaJdbc, cache, javaWs, "mysql" % "mysql-connector-java" % "5.1.+", evolutions ) After refreshing (IntelliJ) and running the application, I still receive the...

Travis-CI - add another task to the sbt command

scala,sbt,travis-ci
I read this: By default, Travis CI will use sbt ++$TRAVIS_SCALA_VERSION test to run your test suite. This can be overridden as described in the general build configuration guide. But that link gives kilobytes and kilobytes of text that I don't grok. In two sentences; how to make Travis CI...

Activator throws IllegalArgumentException: URI has an authority component

playframework-2.0,sbt,typesafe-activator,activator
I'm developing a project in Play 2.4, and I run it using the activator UI. I recently had to forcibly stop the app by pressing "Stop" on the UI, and I haven't been able to get it to work since. Now, on ANY project I open using activator, it never...

Proper way to make a Spark Fat Jar using SBT

scala,jar,apache-spark,sbt,sbt-assembly
I need a Fat Jar with Spark because I'm creating a custom node for Knime. Basically it's a self-contained jar executed inside Knime and I assume a Fat Jar is the only way to spawn a local Spark Job. Eventually we will go on submitting a job to a remote...

scala play keeps throwing InvocationTargetException

scala,exception,sbt,typesafe-activator
I'm trying to develop simple web application using activator and scala play. It worked really fine, however when I tried to add some external JAR into lib/ directory, the following exception is thrown. Even though I don't import anything from it. Any clues? I tried sbt clean and deleting target/...

Cannot run jar file created from scala file

scala,jar,build,sbt
This the code that I have written in scala. object Main extends App { println("Hello World from Scala!") } This is my build.sbt. name := "hello-world" version := "1.0" scalaVersion := "2.11.5" mainClass := Some("Main") This is the command that I have run to create the jar file. sbt package...

Unexpected exception in Play with Scala

scala,playframework-2.0,sbt
I am having an Unexpected exception in my Play2 application with Scala. The same error as mentioned in this question This is what I get in a browser: scala.MatchError: java.lang.StackOverflowError (of class java.lang.StackOverflowError) play.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) play.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44) scala.Option.map(Option.scala:145) play.PlayReload$.taskFailureHandler(PlayReload.scala:44) play.PlayReload$.compileFailure(PlayReload.scala:40)...

IntelliJ - use imported modules as dependencies like maven projects in Eclipse

eclipse,scala,maven,intellij-idea,sbt
I've been asking myself this question for a couple of years but never really found the solution. I used to work with eclipse (on maven java projects). I could import a project -let's call it 'proj-A'- and if one of proj-A's dependencies was found in the workspace with the same...

How to write a plugin which depends on a task from another plugin?

plugins,sbt
There is a great sbt plugin sbt-dependency-graph, which provides a dependencyTree task to show the dependencies. I want to write a sbt plugin which depends on it, but always fails. build.sbt sbtPlugin := true name := "my-sbt-plugin-depends-on-another" version := "0.1.2.1" organization := "test20140913" addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.5") src/main/scala/MySbtPlugin.scala import...

Why can’t SBT resolve SecureSocial-snapshot dependency?

scala,sbt
I want to use this SecureSocial snapshot for my project: https://oss.sonatype.org/content/repositories/snapshots/ws/securesocial/securesocial_2.11/master-SNAPSHOT/ However SBT is unable to resolve it. Here is the error message: [warn] ==== public: tried [warn] https://repo1.maven.org/maven2/ws/securesocial/securesocial_2.11/master-SNAPSHOT/securesocial_2.11-master-SNAPSHOT.pom [warn] ==== typesafe-releases: tried [warn]...

SBT is wasting lots of disk space for dependencies each build

jenkins,sbt,playframework-2.4
We have a Playframework 2.4 (with SBT 0.13.8) project which we build on a Jenkins. Today, the Jenkins stopped working because his $JENKINS_HOME run full. I analyzed which tool was wasting the disk space: SBT. There is a folder located at .sbt/0.13/dependency/module/dynamic that contains quadrillions of subfolders. Each of these...

Scala multi-module project?

java,scala,maven,sbt
I have Java background and thinking of learning Scala. One of this things that I like about using Maven is that I can make a project as multi-maven module. Example? Project/pom.xml /persistence/pom.xml /business/pom.xml /services/pom.xml The nice thing about it is that each of these modules can have their own...

How to check if sbt test failed?

bash,sbt
I want to write a script that builds, test and deploy my app to test environment. I can run test manully using sbt: sbt test but it doesn't seem to return any value (just raw string test results). Is there any better method to check if sbt test failed than...

Ignore dependency jars on dist task

playframework,sbt,sbt-native-packager
I have a Play 2.3.x app that consists of some subprojects, and I use dist to generate a zip package of the full application. The problem is that this package is too big, because it includes every dependency needed for the app to run (ex: scala, play libs, db driver(s),...

Is it possible to do “incremental testing” with sbt and Jenkins?

jenkins,sbt
I migrated a large Maven project with submodules to sbt and got it to build correctly with Jenkins and its sbt plugin. I run sbt compile test. As I understand, sbt compiles incrementally by default. Is it also possible to have it run only tests affected by the changed classes?

SBT: input task to generate a test source by name

scala,sbt
I want to create an sbt task to generate a test source e.g. sbt genSpec Foo should generate FooSpec.scala in src_managed/test I tried this: val genSpec = inputKey[File]("Generate spec file") genSpec := { import sbt.complete.DefaultParsers._ val log = streams.value.log val arg: String = spaceDelimited("<arg>").parsed.head //TODO: Single string parser! val fileName...

Play Framework 2.4 IDE Eclipse directions don't work

eclipse,playframework,sbt,playframework-2.4
The directions can be found here: If I try and do activator eclipse I get an error that eclipse isn't a command. Specifically: "[error] Not a valid command: eclipse" If I I add addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "4.0.0") to plugins.sbt it gives an error....

Increase memory in sbt-assembly

scala,sbt,sbt-assembly
Is there a way to increase the memory during assembly (the plugin)? I notice that adding more memory to sbt through SBT_OPTS does't really help. I suspect that assembly is forking a separate JVM that doesn't inherit the JVM configurations from sbt. Here is the error: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap...

How to use jnaerator in a sbt project

java,c++,maven,sbt,jnaerator
I work on a Scala project that uses c++ code, using sbt. Once compiled, this c++ code is imported into Scala through Java code that uses jna. Now, currently the Java wrapper are manually written, and I like to automatize this. I've found jnaerator that can do that, but I...

InteliJ SBT auto import of scala project gives: Binary incompatibility in plugins detected

intellij-idea,sbt,java-8,scala-2.11
I was working happily in InteliJ with scala 2.10 and Java 1.7 - and am in the process of trying to upgrade to scala 2.11 and Java 1.8 I'm on Ubuntu 14 -- and javac shows update-alternatives --config javac There are 2 choices for the alternative javac (providing /usr/bin/javac). Selection...

IntelliJ Plugin written in Scala - doesn't work

java,scala,intellij-idea,sbt,intellij-plugin
I want to develop my own IntelliJ plugin and I would like to do it using Scala language. When I use Java, everything work perfectly, but I'm not able to run a simple AnAction implemented in Scala. Have a look at these code samples, I have two AnAction implementations, one...

How to install older version of sbt?

scala,sbt
I am facing some "UNRESOLVED DEPENDENCIES" problem for my custom dependencies with latest version of sbt(0.13.8) I want to install older version of sbt, Do we have any command by which I can install older version of sbt ?...

SBT: How can I create a utility jar as a post build step to include all dependent jars in a classpath

sbt,sbt-native-packager
I am quite new to SBT customization. As a post-build step, I would like to create Utility jar which has a class-path that points to all the dependencies. The script created by archetype JavaAppServerPackaging should use this utility jar rather than including all the dependencies as CLASSPATH. How can this...

How to make an sbt task run on under multiple scopes

scala,sbt
I have written an sbt plugin that generates some sources and resources. It is hard coded to work in the Compile scope. How can I make it work in the Test scope too, so I can use the plugin when running tests and it will look in and output to...

ScalaTest on sbt not running any tests

scala,sbt,scalatest
I am trying to run my tests with: sbt and then test. My build.sbt looks like this lazy val scalatest = "org.scalatest" % "scalatest_2.11" % "2.2.4" % "test" lazy val root = (project in file(".")). settings( name := "highlight2pdf", version := "0.1", scalaVersion := "2.11.6", libraryDependencies += scalatest ) And...

spark + sbt-assembly: “deduplicate: different file contents found in the following”

apache-spark,sbt,sbt-assembly
I ran spark application and wanna pack the test classes into the fat jar. What is weird is I ran "sbt assembly" successfully, but failed when I ran "sbt test:assembly". I tried sbt-assembly : including test classes, it didn't work for my case. SBT version : 0.13.8 build.sbt: import sbtassembly.AssemblyPlugin._...

updateStateByKey, noClassDefFoundError

scala,apache-spark,sbt,spark-streaming,sbt-assembly
I have problem with using updateStateByKey() function. I have following, simple code (written base on book: "Learning Spark - Lighting Fast Data Analysis"): object hello { def updateStateFunction(newValues: Seq[Int], runningCount: Option[Int]): Option[Int] = { Some(runningCount.getOrElse(0) + newValues.size) } def main(args: Array[String]) { val conf = new SparkConf().setMaster("local[5]").setAppName("AndrzejApp") val ssc =...

Unable to download com.thoughtworks.paranamer#paranamer;2.5.6 with sbt

maven,sbt
I'm getting the following error when building my project: [warn] problem while downloading module descriptor: https://repo1.maven.org/maven2/com/thoughtworks/paranamer/paranamer/2.5.6/paranamer-2.5.6.pom: invalid sha1: expected=534448ad3c4af760c8995370c1405b9dbf88609e computed=0d33f7748ec6c8928db74f9652a2cb7567fe4044 (116ms) [warn] module not found: com.thoughtworks.paranamer#paranamer;2.5.6 This is a transitive dependency, which I was able to download previously. I got this error when I wiped my ~/.ivy2/cache dir. Not really...

C# Simple SSH Connection And Send Command

c#,ssh,connection,sbt
this is the code i'm using SshClient cSSH = new SshClient("192.168.10.144", 22, "root", "pacaritambo"); cSSH.Connect(); SshCommand x = cSSH.RunCommand("exec \"/var/lib/asterisk/bin/retrieve_conf\""); cSSH.Disconnect(); cSSH.Dispose(); but i want to send command from a textbox so I've tried this SshCommand x = cSSH.RunCommand(textbox3.Text); but didn't work basically i want textbox3.Text as a ssh command....

How can I pass arguments to a custom sbt task from the command line?

sbt,typesafe-activator
I have a custom sbt task myTask, which accepts list of arguments. The task is running fine on the sbt console. sbt_proj> mytask arg1 I want to run this task on the command line : $ sbt myTask arg1 Unfortunately i can't get this working. Any ideas ?...

Why is my Scala class not visible to its matching test class?

scala,intellij-idea,sbt
I am starting out in Scala with SBT, making a Hello World program. Here's my project layout: I've made sure to download the very latest JDK and Scala, and configure my Project Settings. Here's my build.sbt: name := "Coursera_Scala" version := "1.0" scalaVersion := "2.11.6" libraryDependencies += "org.scalatest" % "scalatest_2.11"...

How to add user library as dependency to play framework?

java,sbt,pubnub,playframework-2.4
I am trying to add user library to the project, but while running application showing the following errors. (may be it should be added to sbt files somehow)?/home/thrymr/workspace/androidBackendWorkspace/RideBackend/app/pubnub/Publisher.java:7: package com.pubnub.api does not exist [error] com.pubnub.api.Callback [error] trying to add pubnub jars file....

Typesafe repo: where have most of the packages been moved?

sbt,typesafe
Typesafe's repository no longer contains all the packages it contained a few days ago... I read they are migrating to a new CDN and that user shouldn't have impact... but most of the package are no longer there. Where have they actually been moved? EDIT As requested by jsuereth, here...

Suddenly unresolved dependency echo-trace-play echo-sigar-libs

java,playframework-2.0,sbt,typesafe-activator,typesafe
Yesterday my activator started updating all of the sudden and in the end I got this error: Read from stdout: (:update) sbt.ResolveException: unresolved dependency: com.typesafe.trace#echo-trace-play-2.3.9_2.11;0.1.15: not found Read from stdout: unresolved dependency: com.typesafe.trace#echo-sigar-libs;0.1.15: not found (:31mupdate0m) sbt.ResolveException: unresolved dependency: com.typesafe.trace#echo-trace-play-2.3.9_2.11;0.1.15: not found unresolved dependency: com.typesafe.trace#echo-sigar-libs;0.1.15: not found Already removed all...

Spray microservice assembly deduplicate

scala,sbt,akka,spray,microservices
I'm using this template to develop a microservice: http://www.typesafe.com/activator/template/activator-service-container-tutorial My sbt file is like this: import sbt._ import Keys._ name := "activator-service-container-tutorial" version := "1.0.1" scalaVersion := "2.11.6" crossScalaVersions := Seq("2.10.5", "2.11.6") resolvers += "Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases" libraryDependencies ++= { val containerVersion = "1.0.1" val configVersion = "1.2.1"...

How to import directory of .scala files in sbt (unmanaged)?

scala,import,dependencies,sbt
I have a directory that I want to use as a dependancy for an sbt project however its comprised of .scala files which means I can't place it inside a jar (from what I understand) so then how can I use it as a dependancy for my project? (sbt doesn't...

How to handle more than 11 dependencies to a task in SBT

scala,sbt
I'm working on an sbt plugin where a task needs to depend on more than 11 keys: someKey <<= (a1, a2, ..., a12) map someFunc It won't compile because the implicit conversion map function (e.g. t#ToTable#) only goes up to 11. Is there a better design pattern I should be...

How to properly include ASM in a sbt project

scala,sbt
The scala compiler uses internally ASM for generating byte code. What is more proper way to include ASM in a scala sbt project: to get it somehow from scala compiler or to add as separate library dependency?

sbt: In a multi-project build, how to invoke project B's task from project A?

scala,sbt,scala.js
I have a Build.scala for multiple projects. Two of the projects use ScalaJs cross-compilation. One of the other projects is a pure Scala project, that wants access to some of the ScalaJs-generated Javascript files. (It might be preferable to only access those .js files from the ScalaJs projects, but I'm...

How can I temporarily change scalaVersion in all sub-projects of my sbt build?

sbt
I like to sometimes try out a different version of scala by using sbt's set command like so: set scalaVersion := "2.11.6" However this does not work as expected in a build with sub-projects If I run set scalaVersion := "2.11.6" in the top-level project and then run show scalaVersion,...

Getting a Maven dependency in sbt

scala,maven,sbt
I'm trying to get the library discussed here <repositories> <repository> <id>okapi-xliff</id> <name>okapi-xliff-repository</name> <url>http://repository-okapi-xliff.forge.cloudbees.com/release/</url> <layout>default</layout> </repository> </repositories> ... <dependencies> <dependency> <groupId>net.sf.okapi.lib</groupId> <artifactId>okapi-lib-xliff2</artifactId> <version>1.0</version>...

Include a simple val in sbt build files from global.sbt

sbt
I wish to set my version numbers externally across several build.sbt files through a single include file. Within build.sbt I can do this val base = "1.1" version := base + ".8-SNAPSHOT" This works fine as a first step. According the the online help I should be able to create...

Convert existing SBT Scala application to Play

scala,playframework,sbt,akka
I've been working on building an application with Akka actors, and now that I've completed the actor-based business logic I'd like to give it a RESTful + websocket front-end. I'm trying to find instructions for how to setup Play within the context of an existing application. The only instructions I...

SBT/Scala: macro implementation not found

scala,macros,sbt
I tried my hand on macros, and I keep running into the error macro implementation not found: W [error] (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) I believe I've set up a two pass compilation with...

How to abstract with SBT?

scala,sbt
I have a build.sbt file with the following snippet: scalastyleConfig in Compile := baseDirectory.value / "project" / "scalastyle_config.xml" scalastyleConfig in Test := baseDirectory.value / "project" / "scalastyle_config.xml" When I use IntelliJ to extract variable, I get: val scalaStyleConfig: File = baseDirectory.value / "project" / "scalastyle_config.xml" scalastyleConfig in Compile := scalaStyleConfig...

Why won't my scalatest test compile? (scala.MatchError)

scala,sbt,scalatest
There is all of the code in my project: package fileSearcher import org.scalatest.FlatSpec class FilterCheckerTests extends org.scalatest.FlatSpec { "Foo" should "not do terrible things" in { assert(1 == 1) } } sbt test crashes with scala.MatchError (full details below). What am I doing wrong? [info] Compiling 1 Scala source to...

How to show commands details in sbt?

sbt
In sbt commands displays a list with a default non-descriptive toString > commands [info] List([email protected], [email protected], [email protected], [email protected]) How I could iterate over the list and display a name of the commands?...

OutofMemoryErrory creating fat jar with sbt assembly

jar,cassandra,apache-spark,sbt
We are trying to make a fat jar file containing one small scala source file and a ton of dependencies (simple mapreduce example using spark and cassandra): import org.apache.spark.SparkContext import org.apache.spark.SparkContext._ import com.datastax.spark.connector._ import org.apache.spark.SparkConf object VMProcessProject { def main(args: Array[String]) { val conf = new SparkConf() .set("spark.cassandra.connection.host", "127.0.0.1") .set("spark.executor.extraClassPath",...

Scala sbt jar allows import when class path is passed on command line, but not in REPL

scala,sbt
I've built a small test jar with Scala and SBT. If I put the classpath argument on the Scala REPL command line, it imports the package perfectly. However if I get into the shell and then add the classpath, it does not recognize the import. Being new to Scala this...

Scala REPL import SBT file

scala,sbt,read-eval-print-loop
I have an SBT file that has the following contents: name := "Scala Playground" version := "1.0" scalaVersion := "2.11.6" resolvers += "Typesafe Repo" at "http://repo.typesafe.com/typesafe/releases/" libraryDependencies ++= Seq( "com.netflix.rxjava" %% "rxjava-scala" % "0.19.1", "com.typesafe.play" %% "play-json" % "2.2.1" ) Saved as scala-playground.sbt. I want to use this in my...

Play Framework Scala: Run “test” before “run” in the triggered execution mode

scala,playframework,sbt
Everytime I change code in the project I would like to run two separate sbt actions in this order: test run I thought it is possible with activator/sbt commands like ~ ; test ; run, but it sticks to "run" and don't do any testing until I break sequence with...

Error: Could not retrieve sbt 0.13.8

scala,sbt
i have fresh ubuntu 15.04 and i installed sbt by this guide with echo "deb http://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list sudo apt-get update sudo apt-get install sbt then i just run command in terminal sbt output saying that sbt is trying to install (many many [SUCCESS] messages) and...

specs2: Tag specification/individual test and exclude it from running using sbt

sbt,specs2
I need to skip specifications and individual tests while running my test suite. Here's an example such test: package models import org.specs2.mutable._ import org.specs2.runner._ class SlowTaggedSpecification extends Specification{ "SLOW_SPEC" should { "BAD!! Not Skipped" in { "axbcd" must find( "bc".r ) } } section( "SLOW_SPEC" ) } class SlowFastTaggedSpecification extends...

SBT won't pick the specified mainClass [duplicate]

scala,sbt
This question already has an answer here: How to set main class in build? 2 answers I wrote this scala code package com.abhi import java.io.File object Main1 { def main(args: Array[String]) : Unit = { println("Main1 Hello World") } } object Main2 { def main(args: Array[String]) : Unit =...

Duplication of package scala.sys.process in SBT

sbt
For managing and starting processes, in Scala we have the package scala.sys.process. But SBT have nearly all the classes in that package replicated in the sbt package, with slight variations. E.g. we have scala.sys.process.ProcessBuilder and sbt.ProcessBuilder. I wonder: Why this duplication? Which one should be used?. I've decided to use...

In sbt, how can we specify the version of hadoop on which spark depends?

apache-spark,sbt
Well I have a sbt project which uses spark and spark sql, but my cluster uses hadoop 1.0.4 and spark 1.2 with spark-sql 1.2, currently my build.sbt looks like this: libraryDependencies ++= Seq( "com.datastax.cassandra" % "cassandra-driver-core" % "2.1.5", "com.datastax.cassandra" % "cassandra-driver-mapping" % "2.1.5", "com.datastax.spark" % "spark-cassandra-connector_2.10" % "1.2.1", "org.apache.spark" %...

How to access scala project file from project module

scala,intellij-idea,sbt
I have created a project foo_proj with Intellij (using SBT template) and added a module test_mod to it. The abbreviated directory looks like this foo_proj ├── src │   └── main │   └── scala-2.11 │   └── proj_obj.scala └── test_mod └── src └── tmod.scala The contents of proj_obj.scala are: package com.base.proj object...

sbt multiple native packages

playframework,sbt,sbt-native-packager
So using Scala Play Framework. I have a single codebase but need to launch it 2 ways. One way will launch with Play Netty as the main class, and run a webserver. A second way will run my own main class and do different things. If I do play dist...

Play framework: package javax.inject does not exist

java,build,playframework-2.0,sbt,dependency-management
In my Play 2.0 Framework Java project, the following line yields errors both in Eclipse and during the sbt compile step: import javax.inject.*; I already added the javax.inject dependency to my build.sbt file: libraryDependencies ++= Seq( javaCore, javaJdbc, javaEbean, javaWs, javaFooBar, cache, "javax.inject" % "javax.inject" % "1", "org.atmosphere" % "atmosphere-play"...

What does a bare line on its own do?

sbt
In a .sbt file, I often have copy-pasted lines from readmes, of which I have no idea what I'm actually doing. An example is, after adding sbt-revolver to plugins.sbt, writing the line Revolver.settings My current understanding of what this does is magically adding re-start and re-stop commands to sbt. I...

sbt console how to update to latest Scala version?

sbt
I have installed sbt using the instructions in Installing sbt on Linux. $ sbt --version sbt launcher version **0.13.8** $ sbt console [info] Starting scala interpreter... [info] Welcome to Scala version 2.10.4 (OpenJDK 64-Bit Server VM, Java 1.7.0_79). How to configure (or update) sbt so that sbt console uses the...

Scala / SBT - dependency not resolved on PaaS (cloudControl & heroku)

scala,heroku,sbt,cloudcontrol,stormpath
I have a simple Scala application built using spray.io. I am using Scala 2.11.2 and SBT 0.13.0. All of my dependencies are listed here: libraryDependencies ++= Seq( "com.typesafe.akka" %% "akka-actor" % "2.3.6", "com.typesafe.akka" %% "akka-slf4j" % "2.3.6", "io.spray" % "spray-can_2.11" % "1.3.2", "io.spray" % "spray-routing_2.11" % "1.3.2", "io.spray" % "spray-json_2.11"...

Why do I get conflicting cross-version in sbt on one environment but not another?

scala,sbt,sorm
I have an sbt project with these dependencies: libraryDependencies ++= Seq( "org.scalatra" %% "scalatra" % ScalatraVersion, "org.scalatra" %% "scalatra-scalate" % ScalatraVersion, "org.scalatra" %% "scalatra-specs2" % ScalatraVersion % "test", "ch.qos.logback" % "logback-classic" % "1.1.2" % "runtime", "org.eclipse.jetty" % "jetty-webapp" % "9.1.5.v20140505" % "container", "org.eclipse.jetty" % "jetty-plus" % "9.1.5.v20140505" % "container", "javax.servlet"...

Creating Spark application using wrong Scala version

scala,apache-spark,sbt
I am following the instructions here: https://spark.apache.org/docs/latest/quick-start.html to create a simple application that will run on a local standalone Spark build. In my system I have Scala 2.9.2 and sbt 0.13.7. When I write in my simple.sbt the following: scalaVersion := "2.9.2" after I use sbt package, I get the...

dependency (for javax.script) of SBT build

java,scala,sbt
I am using sbt to build my scala project. I have also java code in my project. When I run the build I constantly get the following error: package javax.script does not exist [error] import javax.script.Invocable; I understand that I need to declare dependency to the javax.script.* , but I...

How can you add custom artifacts in a SBT command

scala,sbt
Can anyone show me how to add multiple Artifacts within a SBT Command? I want to do the following. Given the following tree: - target |- scala-2.10 |- classes |- my |- package |- foo - bar - john - doe I want to create a command that publishes a...

Is it possible to add a resolver to an SBT project's build via an AutoPlugin?

sbt
I am creating an AutoPlugin that wraps a non-auto plugin flywaydb. Unfortunately, the non-auto plugin requires a custom resolver. When I publish our autoplugin, the resolver is not used in the client project's meta build, causing SBT to fail to start with a big stack trace that begins with: sbt.ResolveException:...

What is the definition of the `projects` command in SBT?

scala,sbt
In SBT, we can type projects show the projects in a list, but it seems is not a normal task, because inspect projects or show projects will report: Not a valid project ID: projects (similar: root) What is the projects and how can I find the definition? I want to...

How to express Task dependencies in sbt 13

scala,dependencies,sbt,task
I am trying to express dependencies between two tasks in sbt 13.5. What I want to do is execute TaskB before TaskA will be executed. So I am trying to force the two Tasks to execute sequentially instead of parallel. In other words TaskA should wait for TaskB to finish....

How to parallellize tasks given on the command line

sbt
I'd like to be able to execute dynamically some tasks in SBT. So, I'm using the command line: sbt taskA taskB taskC It works ok, but all of them are executed sequentially. On the other hand, if I programmatically write this inside build.sbt: val allTasks = taskKey[Unit]("All") allTasks := {...

Is a 50M jar file reasonable from 5k lines of scala code?

scala,jar,sbt,filesize,sbt-assembly
I'm building a scala project with ~5k lines of code so far. I'm creating a jar file with sbt assembly. It's coming out to 50M, which is much larger than I'd naively expected. Is this a reasonable sort of size or does it sound suspiciously bloated? I'm just hoping for...

SBT support for custom ivy module status?

sbt,ivy
In my SBT build I have a dependency on an ivy artifact that makes use of a custom module status. This causes the following error in SBT: [error] (*:update) sbt.ResolveException: unresolved dependency: my-org#myapp-core_2.11;1.0: java.text.ParseException: inconsistent module descriptor file found in 'http://artifacts.myorg.com/libs-snapshots-local/myapp-core_2.11/1.0/myapp-ivy.xml': bad status: 'snapshot'; I can work around this by...

Google API: object oauth2 is not a member of package com.google.api.services

google-api,playframework-2.0,sbt,google-api-java-client,google-api-client
I'm developing a web backend using the Google APIs. In order to get the email address of a user, you have to send your access token to a Google tokenInfo service, that will return general information (including your email address). In general Google APIs do not return you the mail...

idea sbt project when I run test case it does not compile

intellij-idea,junit,sbt
I use JUnit for the test,when I change some codes, I must make project manually, it can't auto compile like maven. If I doesn't make project it is the last time code. Can anybody tell me why? Thanks a lot!

SBT: execute task using other task value

scala,build,sbt,sbt-0.13
I redefine my tests to supply some arguments from configuration to test suite: This is an excerpt from my Build.scala: object Build extends Build { lazy val myProject = (project in file("my_project")).settings( test in Test := myProjectTest.value ) val myProjectTest = Def.task { (testOnly in Test).toTask(" tests.Suites -- " +...

Difficulty with SBT

scala,sbt
I have started using scala sbt pretty recently. One thing which I find very difficult with SBT is to find the right dependency signature. for example, I am reading a blog which was written in 2014 and it says add the following libraryDependencies "net.liftweb" %% "lift-son" % "2.5+" "org.apache.httpcomponents" %%...

Typesafe Activator: “run” works, but “start” fails with an error

java,scala,playframework-2.0,sbt,typesafe-activator
I'm working on a project, using Java Play-framework. Until now I always tested it by executing ./activator run, which worked flawlessly. Now, I wanted to try and deploy it by running ./activator start instead. This raises a compilation error though, and I don't know why because the code seems to...

Specify plugins in Build.scala

scala,sbt
If I want to use a build.scala file in order to build my project (instead of build.sbt) how do I specify the plugins? I want to use the sbt-assmbly plugin. and I am aware that I can create a plugins.sb file and do a addSbtPlugin there. But i want to...

SBT Unresolved Dependencies

scala,sbt
This is an SBT build file which I have written name := "Introduction" version := "1.0" scalaVersion := "2.11.2" resolvers ++= Seq( "snapshots" at "http://oss.sonatype.org/content/repositories/snapshots", "releases" at "http://oss.sonatype.org/content/repositories/releases" ) libraryDependencies ++= Seq("org.specs2" %% "specs2" % "1.12.3" % "test") when I run sbt compile I get error message [info] Resolving org.specs2#spec2_2.11;1.12.3...

Play framwork Host repo.typesafe.com not found

sbt,playframework-2.3,typesafe-activator
Environment: Play framework; activator-1.3.2; Play-Java Web Application build.sbt - name := """ProjectDemoNew""" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.1" resolvers +="Local Maven Repository" at "file:///home/shiva/.m2/repository" libraryDependencies ++= Seq( javaJdbc, javaEbean, cache, javaWs, "org.springframework" % "spring-context" % "3.2.3.RELEASE", "org.springframework" % "spring-aop" % "3.2.3.RELEASE", "org.springframework" %...

`Import from illegal package` error

java,scala,sbt,opencsv
Anyone knows why I get the error Table.scala:8:0: Import from illegal package from the following code? Line 8 is referring to import scala.collection.JavaConversions._ import org.allenai.common.Logging import scala.collection.parallel.mutable import java.io.FileReader import au.com.bytecode.opencsv.CSVReader import scala.collection.JavaConversions._ /** Created by i-danielk on 6/11/15. */ class Table(fileName: String) extends Logging { val (titleRow, contentMatrix) =...

SBT Output for Kind Type

scala,sbt
With respect to type theory, the field of mathematics and computer science both tend to use the same notation for kinds and kinds construction, namely the symbols: * -> Haskell even adopts this notation: Prelude> :k Maybe Maybe :: * -> * But in sbt, we get: scala> :k Option...

sbt cannot find the scripted-sbt dependency

sbt
I'm using the scripted sbt plugin for one of my projects and it has been working fine, but stopped working sometime recently for no obvious reason. Here is a sample setup that fails: # project/plugins.sbt libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value # build.sbt scalaVersion := "2.11.6" scriptedSettings # project/build.properties...

add sbt-web resources jar to classpath of sbt-native-packager

sbt,sbt-native-packager,sbt-web
I have a multi-project build and I'm trying to add the jar with assets generated by sbt-web to the classpath of the launch script The project I'm interested in is called website. typing show website/web-assets:packageBin in sbt creates and shows the jar with the assets. I tried putting in (managedClasspath...

How to avoid stack trace with sys.error(message)

sbt
In some custom tasks, I detect some error, and I'm using this way to signal an error and stop processing current task: sys.error("Some error") Internally it throws a RunTimeException. SBT shows a stack trace, and I'd like to report an error without stack trace. For expected errors, it is often...

SBT with Maven Central - get rid of Scala version in artifact url

scala,sbt,dependency-management,maven-central
I am trying to use in my Scala project Java library which is on Maven Central. While resolving this dependency, SBT appends Scala version to the repository url which obviously does not exist in such a format. Can I somehow disable appending Scala version for this specific artifact?

How do I set Java options in SBT for the test configuration only?

sbt
I currently have a command line sbt -Dsome.configuration.option test doing what I want, but I would like it to apply that configuration option automatically for sbt test (and no other sbt phase). If my terminology is correct, then I want to set a Java Option for the Test Configuration. How...

hot swap in sbt project without play-plugin

scala,playframework,sbt
When I am using play framework, every time I've changed the code, it will take effect automatically by re-compile the code. However, when I'm using sbt to run a project without play-plugin, it won't take effect. I'm wondering if there were a way to make sbt project hot swap the...