Questions tagged [sbt]

1

votes
1

answer
580

Views

How can I exclude all transitive dependencies of a library in SBT?

Practically I just want to port this Gradle code to SBT: compile('group:name:version') { transitive = false } How could I achieve that?
Nicofisi
1

votes
1

answer
518

Views

How to install sbt ensime plugin globally?

I've created ~/.sbt/1.0/plugins/plugins.sbt After that cd into ~/.sbt/1.0/plugins I've run addSbtPlugin('org.ensime' % 'sbt-ensime' % '2.5.1') But I had this error zsh: unknown sort specifier Any Ideas?
Dimitar Nonov
1

votes
2

answer
64

Views

How can I get the path to the current target directory in my build.sbt

In my build.sbt I want to know the current target file. Something like this: val targetFile = ??? // /home/fbaierl/Repos/kcc/scala/com.github.fbaierl/target/scala-2.12/myapplication_2.12-1.2.3-SNAPSHOT.jar With target.value I only get the directory up until /target. Is there any way to get the full...
Florian Baierl
1

votes
2

answer
94

Views

When to use “sbt assembly” and “sbt compile && sbt package”?

I would like to know when should I use sbt assembly and when sbt compile && sbt package? I'm coding a program in my local computer using Intellij IDEA and I'm compiling it with sbt compile && sbt package, then I'm going to upload it to a cluster and run it using spark-submit. Is this the best way? W...
diens
1

votes
1

answer
78

Views

Publish artifact to local maven repo with SBT and use it in Gradle project

Here is what I want to do: In my Scala sbt project, I want to publish an artifact to my local maven repository Afterwards, I want to use this artifact in a Gradle-based Java project Here is where I struggle: I have published the artifact somewhat successful using sbt publishM2. Here is my build.sbt:...
Florian Baierl
1

votes
2

answer
27

Views

How to change path to credentials file (without environment variable)

I currently set path to a credentials file like this: credentials += Credentials(Path.userHome / '.myfolder' / 'my.credentials') on my local computer this works because Path.userHome results in ~. However, on Jenkins Path.userHome results in /root and I'm unable to create .myfolder under /root at bu...
Anthony
1

votes
0

answer
21

Views

Play Framework Modeling

I'm new to Play framework using Java and need some help on how the Modeling works using Ebean to connect to mysql database, what I want to do now is to create models and I have succeeded on connecting to database and connecting to it with the conventional steps on Play Framework Documentation, but t...
Whales
1

votes
0

answer
205

Views

Sbt ( new version 1.0.4) assembly failure

I have been trying to build fat jar for some time now. I got assembly.sbt in project folder and it looks like below addSbtPlugin('com.eed3si9n' % 'sbt-assembly' % '0.14.6') and my build.sbt looks like below name := 'cool' version := '0.1' scalaVersion := '2.11.8' resolvers += 'Hortonworks Repositor...
ram
1

votes
1

answer
571

Views

Preserving Manifest.mf when building via sbt assembly

When I build my project using sbt assembly, I get java.util.zip.ZipException: duplicate entry: META-INF/MANIFEST.MF. The solution that google recommends, is to use MergeStrategy.discard. That works in getting the project to build - but it crashes at runtime, because Dropwizard (a dependency) relies...
Click Upvote
1

votes
1

answer
38

Views

Difference between `=` and `:=` in sbt

val gitHeadCommitSha = taskKey[String]('Determines the current git commit SHA') gitHeadCommitSha := Process('git rev-parse HEAD').lines.head In the above code, I suppose = creates a key (which I suppose is analogous to declaring a variable and := declares a setting. So does SBT allow declaring a k...
Manu Chadha
1

votes
0

answer
47

Views

What is the equilent plugin of spring-boot-maven-plugin for sbt?

Hive everyone, I try to migrate a spring boot application from maven to sbt. All work perfectly but to package the jar with sbt, I can't use anymore spring-boot-maven-plugin. Do you know what can I use for sbt?
a.moussa
1

votes
1

answer
1.3k

Views

How can I install older version (0.13.x) sbt on my MAC?

I need sbt version 0.13.x for a course in Scala and I am having difficulties installing it. I tried with the 'brew install [email protected]' command, but when I then check with 'sbt about' it gives a message 'No such file or directory'.  However, if I again try and do 'brew install [email protected]', it gives 'War...
kris
1

votes
0

answer
73

Views

Setting 'testFrameworks' in build.sbt of a scalajs project causes java.lang.NullPointerException when running test

I am new to scala and scalajs. I am trying to add unit tests to my scalajs project using minitest. I followed instructions at https://github.com/monix/minitest#usage-in-sbt, so this is what my build.sbt looks like: enablePlugins(ScalaJSPlugin, WorkbenchPlugin) name := 'Test' version := '0.1-SNAPSHOT...
qcabeza
1

votes
1

answer
210

Views

How to resolve libraryDependencies after sbt version upgrade to sbt 1.0

Hi my question refers to an old thread : Multi-version build with SBT This is exactly how the library dependencies are mentioned in my project as well libraryDependencies Seq( 'net.databinder.dispatch' %% 'dispatch-core' % dv, 'net.databinder.dispatch' %% 'dispatch-json4s-native' % dv )} but we hav...
Ashen
1

votes
0

answer
41

Views

How to disable re-compilation for dependent module?

There is a sbt-project with the following modules: val core: Project = ... val moduleA: Project = project.settings(...) .dependsOn(core) var root: Project = Project( id = '...', settings = ..., base = file('.')).aggregate(moduleA) The core module has a lot of classes. The modlueA is a web-module whi...
John Mullins
1

votes
1

answer
221

Views

SBT ignore repository proxy for ivy plugins

I've tried to follow the explanation to proxy ivy and sbt artifacts http://www.scala-sbt.org/1.x/docs/Proxy-Repositories.html Nevertheless, it looks like SBT just ignores my settings, This is my environemnt: Nexus 3.7.1 Several SBT versions (0.13.15 , 0.13.16, 1.0.0, 1.1.0) Several maven repositorie...
Y. Eliash
1

votes
0

answer
91

Views

Can I force Ebean enhancement while sbt recompiles the project?

I have following hierarchy: @MappedSuperclass public abstract class BaseModel extends Model { // common persistent fields for all entities, (id, timestamps etc.) } @MappedSuperclass public abstract class SpecificModel extends BaseModel { // common persistent fields for only some entities } @Enti...
lexa274
1

votes
0

answer
176

Views

scala sbt common dependencies for multiple external projects with subprojects without plugin

Following is my situation: I want something like: root --ProjectSetA --SubProjectA1 --SubProjectA2 --project/Dependencies --DepA1 --DepA2 --build.sbt(to aggregate all in SetA) --ProjectSetB --SubProjectB1 --SubProjectB2 --project/Dependencies --DepB1 --DepB2 --build.sbt(to aggregate all in SetB) --b...
abroy
1

votes
1

answer
592

Views

Reading sbt dependency tree

I'm upgrading some libraries within a Play! project. During the process I'm trying to resolve errors like this: java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLoggingFilter Which I am assuming comes from incompatible transitive dependencies? But I'm struggling to effectively use sbt-depend...
tgk
1

votes
0

answer
283

Views

sbt plugin dependency not resolved from nexus - Server access Error: Connection timed out

I have a Play Framework project (v2.5.3) using sbt v0.13.11. I have installed the latest version of sbt 1.1.0 (do I need to install an older version?). I have also installed the latest version of Intellij 2017.3. We are using a corporate nexus server to resolve sbt dependencies. My repositories file...
Vanessa
1

votes
1

answer
161

Views

Scala.js crossProject vs manual setup

To compile the same source code with Scala.js and Scala JVM the documentation says to use crossProject, for instance lazy val foo = crossProject.in(file('.')). settings( name := 'foo', version := '0.1-SNAPSHOT' ) lazy val fooJVM = foo.jvm lazy val fooJS = foo.js However it looks that the same goal c...
Yaroslav
1

votes
1

answer
352

Views

unable to connect to tcp port running in docker

I have written a mqqt broker using sbt and Akka. I run fine on my local machine but I am unable to connect to the broker when I run my code in the docker container.I see broker is running fine on port 1883. Docker logs:- [DEBUG] [02/17/2018 04:24:29.682] [run-main-0] [EventStream(akka://TcpServer)...
abhishek_rathaur
1

votes
0

answer
113

Views

Identify string constants in source code at compile time

I have a requirement to check if a specific string constant is used in source code in a Scala project built with SBT. class Test { def f(s: String) = { val na = s'... from t2_trans where na_id > 300' ... na } I would like to catch the string t2_ is used in class Test when I compile/build the project...
Arun Vasu
1

votes
0

answer
34

Views

Modify files in unmanagedSourceDirectories during build

I have a multi-module SBT project that writes sources to the unmanagedSourceDirectories during the first module and then subsequently uses the contents during later modules (this process repeats). The project structure looks like this: root + gen - writes content to useA/target/generated-sources + u...
ChoppyTheLumberjack
1

votes
0

answer
13

Views

Should plugins cache Initialize[Task[T]] objects?

By trial and probably error, as a plugin author I've fallen into using the following style, which seems to work: object AmazingPlugin extends AutoPlugin { object autoImport { val amaze = TaskKey[Amazement]('Do something totally effing amazing') } import autoImport._ lazy val ethDefaults : Seq[sbt.De...
Steve Waldman
1

votes
1

answer
64

Views

Different output depending on compilation with intellij or sbt

I have the following scala program that simply counts the words in a file: package com.impatient import java.util.Scanner object Main extends App { countWords() def countWords(): Unit = { val in = new Scanner(new java.io.File('C:\\tmp\\SampleText.txt')) var wc = 0 while (in.hasNext()) { var word = i...
s952163
1

votes
0

answer
170

Views

how sbt merge strategy really works on deduplicate errors?

I'm new to sbt and sbt-assembly plugin. I tried to build 2 jars from different packages in the scala play project. I read the Merge Strategy section in https://github.com/sbt/sbt-assembly but still don't quite understand how the mapping of path names work. Could you please give me advise? I don't q...
David
1

votes
1

answer
231

Views

SBT execute task of other project before running run task

I have two projects in my SBT buildfile core and runner lazy val core = (project in file('.')) lazy val runner = (project in file('runner')) .settings(mainClass in (Compile, run) := Some('Main')) I would like packageBin task of core project to be executed before I execute run task of my runner proj...
Ilya Kirillov
1

votes
0

answer
61

Views

Trying to use different pipelineStages for prod and dev in sbt-web

I have a project using Play Framework 2.3 and I'm having some issues with how JS files are handled throughout the asset pipeline. I want to process my JS source files differently depending on if the application is started in dev or prod mode. Specifically, I wan't to run pipeline stages called trans...
Lennholm
1

votes
0

answer
39

Views

How to access resources generated by sbt?

Here's part of my build.sbt: Project(...)... .settings(..., resourceGenerators in Compile += myTask.taskValue, mappings in (Compile, packageSrc) += { ((resourceManaged in Compile).value / fileName) -> fileName } ) Basically, I want to load this file at runtime -- how do I do that/where do I lo...
allidoiswin
1

votes
0

answer
51

Views

issue to generate fat jar for the subproject in subpackage

I defined the subproject to create the fat jar for subpackage com.mycompany.proj.util. But the jar created (using sbt utilProject/assembly) only contains scala sdk classes and did not have the subpackage classes. Any ideas why? Do I need to specify the full path of the package? thanks lazy val utilP...
David
1

votes
0

answer
105

Views

Using playframework without sbt plugin

I like playframework, but I don't like sbt. Finally there's a good alternative: mill; but I cannot use it with Playframework because, regardless of the minimality of it, play is more than just a couple of libraries. Play is an sbt plugin, which I'm pretty sure does the compilation of assets and rout...
caeus
1

votes
0

answer
372

Views

sbt error ClassNotFoundException in WordCount

it might be a newbie question but i'm trying to learn more about scala in intellij. I firstly created a simple HelloWorld project that worked fine. Next i watched a tutorial to create a WordCount project, but i'm getting exception error that i can't figure out. The error i get is: Error:Error while...
user3121051
1

votes
1

answer
370

Views

sbt: Module not found: sbt-buildinfo

I have created a hello-world sbt project and I would like to fetch a GitHub dependency. In particular, that dependency is the Scala compiler. In particular, I am creating a directory scala-dep-example and inside that directory, I have the following two files: // File 1: Test.scala object ScalaDepTes...
Than21
1

votes
1

answer
145

Views

compiling and running jars with scalac vs sbt?

I am trying to compile a fat jar for my Scala project that contains all of my dependencies according to this stackoverflow post, so that I can use it in a Java application. I am new to Scala/Java/JVM, so please be patient. I am using IntelliJ and scala 2.12.4, however I am running my sbt commands fr...
SnarkShark
1

votes
1

answer
72

Views

Spark libraries conflect when cosmosdb Lib

I keep getting a spark library conflict with cosmosdb libraries and unable to resolve it. Please help??? build.sbt name := 'myApp' version := '1.0' scalaVersion := '2.11.8' libraryDependencies ++= Seq( 'org.apache.spark' % 'spark-core_2.11' % '2.3.0', 'org.apache.spark' % 'spark-sql_2.11' % '2.3.0...
Tom
1

votes
0

answer
147

Views

Running tests from a jar file?

i am trying to run the tests that was compiled into a -test.jar using sbt test:package and i copied the Jar files into a lib directory of another project i tried doing so as follows sbt> test:runMain scalatest.Runner -s package.Classname no luck. any idea how to accomplish this?
DevZer0
1

votes
0

answer
91

Views

How can I read the Play! application version from command line?

I am trying to create a script to make the release of my Play application and I would like to be able to read the version set in the 'application.conf' file. app.version = '0.1.1' Is there any command in SBT to read values from the Typesafe config? Or, do I need to parse the file myself? I don't nee...
kepa
1

votes
1

answer
96

Views

Check a code of Spark RDD using local REPL

I want to check my scala spark code by REPL. This code works well in spark-shell, but local scala with sbt didn't work. (After executing sbt in the command line, and execute console command to start REPL.) What should I do? code import org.apache.spark.SparkContext import org.apache.spark.Spar...
k_trader
1

votes
0

answer
45

Views

Converting SBT ModuleID with CrossVersion to string

How do I convert an sbt ModuleID to a string containing a CrossVersion to a string? In build.sbt (or in a plugin), both the following lines print com.example:test:0.1.0-SNAPSHOT: println('com.example' %% 'test' % '0.1.0-SNAPSHOT') println('com.example' % 'test' % '0.1.0-SNAPSHOT') from the first exa...
tjarvstrand

View additional questions