I am trying to add below dependency but it is never resolved.
libraryDependencies += "com.typesafe" % "config" % "1.3.2"
Below are the versions used
scalaVersion := "2.12.7"
sbt.version = 1.2.4
Try adding resolver in plugin.sbt as
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
Related
I am publishing a jar file to my local Ivy repository using publish-local (which has worked for me in the past). Sbt version is 0.13.9. Even though I am not getting any exceptions when I publish the jar file, my local Ivy repository is not getting updated (I have to remove the ivy.xml file inside my cache directory in order for the process to work correctly). The same issue was replicated on another computer so its not specific to my computer. I have copied snippets of the sbt build file. Any thoughts on what might be causing the issue to surface?
organization := "com.test"
name := "test123"
version := "1.0.0"
scalaVersion := "2.11.7"
crossPaths := false
autoScalaLibrary := false
resourceDirectory in Compile := baseDirectory.value / "conf"
javacOptions in (Compile) ++= Seq("-Xdoclint:none")
resolvers ++= Seq(
"Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
)
libraryDependencies ++= {
Seq(
"junit" % "junit" % "4.12",
"com.novocode" % "junit-interface" % "0.11" % "test",
"com.amazonaws" % "aws-java-sdk" % "1.11.18"
)
}
I removed some of the dependencies in the build file. I run the following every time:
sbt clean reload compile publish-local
I was able to accomplish this by using the following plugin:
https://github.com/sbt/sbt-dirty-money
This allowed the older published artifact to be removed from the local ivy repository.
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 in website) += website/web-assets:packageBin, but that doesn't compile:
path/to/build.sbt:58: error: value / is not a member of sbt.Project
managedClasspath in website += website/web-assets:packageBin
How can I create the jar with assets when I run the stage task, and place it on the classpath of the launch script
You are mixing sbt-console commands with build.sbt commands.
The sbt-web docs give a clear example how you do it for a single project:
(managedClasspath in Runtime) += (packageBin in Assets).value
So now we do the same thing for a multi-module build. Assuming you have a build.sbt that looks like this
val root = (project in ".")
.aggregate(common, website)
val common = (project in "commons")
.settings(
libraryDependencies ++= Seq(...),
...
)
val website = (project in "commons")
.enablePlugins(JavaServerAppPackaging, SbtWeb)
.settings(
// ------ You configure it like a single module project
(managedClasspath in Runtime) += (packageBin in Assets).value
// ----------------------------------------------------
)
.dependsOn(common)
I have not directly tested this as I don't know your exact configuration. However this should give you the right direction.
I'm using latest version of sbt 0.13.7, and I'd like to set Class-Path header of my MANIFEST.MF file with all the project dependencies, and I don't really know how. I did read Configure packaging.
I do know how to set other headers like Main-Class:
mainClass in (Compile, packageBin) := Some("mypackage.MyClass")
I know it can be done with the sbt-assembly plugin, but I don't want to create one big jar, just a small jar, that includes all the dependencies.
I found I could set Class-Path with *.jar, as shown in this snippet:
packageOptions in (Compile, packageBin) +=
Package.ManifestAttributes(java.util.jar.Attributes.Name.CLASS_PATH -> "*.jar")
It appears a kind of workaround not a final solution. Any guidance very welcome.
I am using sbt for an Akka project. I want to redirect the output of the logger. Therefore I'd like to use logback.
What do I have to add to build.sbt to manage the library dependency for logback?
Add the following to build.sbt:
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.3"
When I compile Scala code, by running sbt compile, SBT says:
$ sbt compile
...
[warn] there were 5 deprecation warnings; re-run with -deprecation for details
...
How do I do that? (From within SBT?)
sbt shell
While in sbt shell (if you don't want to change your build.sbt):
$ sbt
> set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation")
> compile
> exit
Due to in ThisBuild, set applies the settings to all sub-projects, as well.
Command Line
You could also run the above as a single command on command line.
sbt '; set ThisBuild/scalacOptions ++= Seq("-unchecked", "-deprecation") ; compile'
The trick is to use ; (semicolons) to separate commands and ' (ticks) to include all ;-separated commands as a single argument to sbt.
sbt < 1.x
Instead of ThisBuild/scalacOptions use scalacOptions in ThisBuild
scalacOptions := Seq("-unchecked", "-deprecation")
Add this setting to your build.sbt, and, if you have a multi-module project, add it to every project's settings.
As times flows new solutions are emerged. So, now you could re-run the scala compiler without issuing entire project rebuild.
You need to install ensime-sbt plugin:
addSbtPlugin("org.ensime" % "sbt-ensime" % "1.0.0")
After that you could use the ensimeCompileOnly task to compile single file. SBT allows per tasks settings configuration, so you could change for that tasks only:
set scalacOptions in (Compile, EnsimeKeys.ensimeCompileOnly) += "-deprecation"
ensimeCompileOnly src/main/scala/MyFile.scala