lift does not build with sbt? - lift

I am following the steps for sbt 0.10 on the Assembla Lift wiki and get the following error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.github.mpeltonen#sbt-idea_2.8.1;0.10.0-SNAPSHOT: not found
[warn] :: com.github.siasia#xsbt-web-plugin_2.8.1;0.10.1: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
probably because both pages:
http://siasia.github.com/maven2
and
http://mpeltonen.github.com/maven/
don't exist?
My build.sbt:
name := "MyWeb"
scalaVersion := "2.9.0"
seq(WebPlugin.webSettings: _*)
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
resolvers += "Web plugin repo2" at "http://mpeltonen.github.com/maven/"
libraryDependencies ++= {
val liftVersion = "2.4-M1"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile->default",
"net.liftweb" %% "lift-mapper" % liftVersion % "compile->default",
"net.liftweb" %% "lift-wizard" % liftVersion % "compile->default"
)
}
libraryDependencies ++= Seq(
"junit" % "junit" % "4.5" % "test->default",
"org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty",
"javax.servlet" % "servlet-api" % "2.5" % "provided->default",
"com.h2database" % "h2" % "1.2.138",
"ch.qos.logback" % "logback-classic" % "0.9.26" % "compile->default"
)
and plugins/build.sbt:
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
libraryDependencies <+= sbtVersion("com.github.siasia" %% "xsbt-web-plugin" % _)
What am I doing wrong?

This link might helpful.
https://github.com/siasia/xsbt-web-plugin
Replace contents of project/plugins/build.sbt like below
resolvers ++= Seq(
"Web plugin repo" at "http://siasia.github.com/maven2",
Resolver.url("Typesafe repository", new java.net.URL("http://typesafe.artifactoryonline.com/typesafe/ivy-releases/"))(Resolver.defaultIvyPatterns)
)
//Following means libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.1.0-<sbt version>""
libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % ("0.1.0-"+v))
and replace seq(WebPlugin.webSettings: _*) with seq(webSettings :_*) in project root's build.sbt

Related

Why is Scala looking for SNAPSHOT version?

I mentioned json4s-native 3.3.0 but it refering 3.3.0-SNAPSHOT.
In my project there is 3 modules (common, read and write) each have its scala.sbt.
Before change:
"org.json4s" %% "json4s-native" % Versions.Json4s % "compile",
After change:(Changed all the places in 3 modules)
"org.json4s" %% "json4s-native" % "3.3.0" % "compile",
I run:
sbt
clean
update
Error:
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: org.json4s#json4s-native_2.10;3.3.0-SNAPSHOT: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn]
[warn] Note: Unresolved dependencies path:
[warn] org.json4s:json4s-native_2.10:3.3.0-SNAPSHOT
My Sales buld.sbt is this:
name := "myapp-sales"
organization in ThisBuild := "com.mycompany"
scalaVersion in ThisBuild := "2.11.7"
//crossScalaVersions in Thisq
//Build := List("2.10.5", scalaVersion.value)
//crossPaths := false
scalacOptions in Compile in ThisBuild ++= Seq("-unchecked", "-deprecation", "-encoding", "utf8", "-language:postfixOps", "-language:implicitConVersions")
lazy val common = Project("myapp-sales-common", file("common"))
lazy val read = Project("myapp-sales-read", file("read")).configs(IntegrationTest).settings(Defaults.itSettings: _*).dependsOn(common, write)
lazy val write = Project("myapp-sales-write", file("write")).configs(IntegrationTest).settings(Defaults.itSettings: _*).dependsOn(common)
conflictWarning in ThisBuild := ConflictWarning.disable
parallelExecution in Test in ThisBuild := false
parallelExecution in IntegrationTest in ThisBuild := false
javacOptions in Compile in ThisBuild ++= Seq("-source", "1.6", "-target", "1.6")
//Remove SNAPSHOT check from the release process (for now until Squants gets a release)
releaseProcess := releaseProcess.value.filterNot(_ == ReleaseTransformations.checkSnapshotDependencies)
My read module build.sbt:
libraryDependencies ++= Seq(
"com.mycompany" %% "myapp-core-read" % myappsales.CoreVersion % "compile", // disable using the Scala version in output paths and artifacts,
"com.mycompany" %% "myapp-core-write" % myappsales.CoreVersion % "compile",
"com.mycompany" %% "myapp-registration-common" % myappsales.RegistrationVersion % "compile",
"com.mycompany" %% "myapp-load-common" % myappsales.LoadVersion % "compile",
"com.mycompany" %% "myapp-core-write-test" % myappsales.CoreVersion % "it, test",
"com.mycompany" %% "myapp-core-test" % myappsales.CoreVersion % "it, test"
)
libraryDependencies ++= Seq(
"com.typesafe" % "config" % myappsales.TypeSafeConfigVersion % "compile",
"org.json4s" %% "json4s-native" % Versions.Json4s % "compile",
"io.spray" % "spray-routing" % Versions.Spray % "compile",
"com.typesafe.akka" %% "akka-actor" % Versions.Akka % "compile",
"com.typesafe.akka" %% "akka-remote" % Versions.Akka % "compile"
exclude ("io.netty", "netty")
)
//Assemby settings
test in assembly := {}
assemblyShadeRules in assembly := Seq(
ShadeRule.rename("play.api.libs.iteratee.**" -> "shade.play.api.libs.iteratee.#1")
.inLibrary("play" % "play-iteratees_2.10" % "2.1-RC2")
.inLibrary("org.reactivemongo" % "reactivemongo_2.10" % "0.8.1-SNAPSHOT"),
ShadeRule.rename("scala.concurrent.stm.**" -> "shade.scala.concurrent.stm.#1")
.inLibrary("org.scala-stm" % "scala-stm_2.10.0" % "0.6")
.inLibrary("play" % "play-iteratees_2.10" % "2.1-RC2")
)
assemblyMergeStrategy in assembly := {
case "application.conf" => MergeStrategy.concat
case path => MergeStrategy.defaultMergeStrategy(path)
}
//Make assembly a publishable artifact
artifact in (
Compile, assembly) := {
val art = (artifact in (Compile, assembly)).value
art.copy(`classifier` = Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
Why it still looking for SNAPSHOT version?
There's a fairly standard way of investigating this kind of problems. In your plugins.sbt
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
Then go sbt dependencyBrowseGraph, this will open your browser and take you to a page where the entire graph of your dependencies including the evicted one can be browsed. Now figure out where the SNAPSHOT is coming from and get rid of it with an exclusion.

sbt, intellij jar in external library but not found when compile

encounter a very strange problem.
I'm trying to use reactivemongo. And after update build.sbt
I can see that the jar is in the external library. However the compilation failed because not found object reactivemongo.
my build.sbt is:
hereenter code herelazy val commonSettings = Seq(
hereorganization := "emmettng.com",
hereversion := "0.0.1",
scalaVersion := "2.11.8"
)
hereresolvers += "Typesafe Repo" at"http://repo.typesafe.com/typesafe/releases/"
resolvers += "Typesafe repository releases" at"http://repo.typesafe.com/typesafe/releases/"`
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-reflect" % "2.11.8",
"org.scala-lang.modules" % "scala-xml_2.11" % "1.0.4",
``"org.scalatest" %% "scalatest" % "3.0.0" % "test",
"com.typesafe.play" %% "play-json" % "2.4.0-M3",
"org.scalaz" %% "scalaz-core" % "7.2.5",
"junit" % "junit" % "4.10" % "test",
"org.reactivemongo" %% "reactivemongo" % "0.11.14"
)

Spray microservice assembly deduplicate

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"
val akkaVersion = "2.3.9"
val liftVersion = "2.6.2"
val sprayVersion = "1.3.3"
Seq(
"com.github.vonnagy" %% "service-container" % containerVersion,
"com.github.vonnagy" %% "service-container-metrics-reporting" % containerVersion,
"com.typesafe" % "config" % configVersion,
"com.typesafe.akka" %% "akka-actor" % akkaVersion exclude ("org.scala-lang" , "scala-library"),
"com.typesafe.akka" %% "akka-slf4j" % akkaVersion exclude ("org.slf4j", "slf4j-api") exclude ("org.scala-lang" , "scala-library"),
"ch.qos.logback" % "logback-classic" % "1.1.3",
"io.spray" %% "spray-can" % sprayVersion,
"io.spray" %% "spray-routing" % sprayVersion,
"net.liftweb" %% "lift-json" % liftVersion,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test",
"io.spray" %% "spray-testkit" % sprayVersion % "test",
"junit" % "junit" % "4.12" % "test",
"org.scalaz.stream" %% "scalaz-stream" % "0.7a" % "test",
"org.specs2" %% "specs2-core" % "3.5" % "test",
"org.specs2" %% "specs2-mock" % "3.5" % "test",
"com.twitter" %% "finagle-http" % "6.25.0",
"com.twitter" %% "bijection-util" % "0.7.2"
)
}
scalacOptions ++= Seq(
"-unchecked",
"-deprecation",
"-Xlint",
"-Ywarn-dead-code",
"-language:_",
"-target:jvm-1.7",
"-encoding", "UTF-8"
)
crossPaths := false
parallelExecution in Test := false
assemblyJarName in assembly := "santo.jar"
mainClass in assembly := Some("Service")
The project compiles fine!
But when I run assembly, the terminal show me this:
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] /path/.ivy2/cache/io.dropwizard.metrics/metrics-core/bundles/metrics-core-3.1.1.jar:com/codahale/metrics/ConsoleReporter$1.class
[error] /path/.ivy2/cache/com.codahale.metrics/metrics-core/bundles/metrics-core-3.0.1.jar:com/codahale/metrics/ConsoleReporter$1.class
What options do I have to fix it?
Thanks
The issue as it seems transitive dependency of the dependency is resulting with two different versions of metrics-core. The best thing to do would be to used the right library dependency so that you end up with a single version of this library. Please use https://github.com/jrudolph/sbt-dependency-graph , if it is difficult to figure out dependencies.
If it is not possible to get to a single version then you would most likely to go down exclude route . I assume, this only work, if there is compatibility between the all required versions.

SBT not resolving sbt-heroku plugin dependency

I'm moving my app from RUN#Cloud to Heroku. I try to deploy the app to Heroku using sbt-heroku plugin. The dependency doesn't want to resolve.
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.heroku#sbt-heroku;0.1.5: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt version is 0.13.1. The content of Build.scala file:
object ApplicationBuild extends Build {
val appName = "happymelly-teller"
val appVersion = "1.0-SNAPSHOT"
val appDependencies = Seq(
jdbc,
cache,
filters,
"be.objectify" %% "deadbolt-scala" % "2.2-RC2",
"com.andersen-gott" %% "scravatar" % "1.0.3",
"com.github.tototoshi" %% "slick-joda-mapper" % "0.4.0",
"com.typesafe.play" %% "play-slick" % "0.5.0.8",
"com.heroku" % "sbt-heroku" % "0.1.5",
//"com.typesafe.slick" %% "slick" % "1.0.1",
"mysql" % "mysql-connector-java" % "5.1.27",
"org.apache.poi" % "poi" % "3.9",
"org.apache.poi" % "poi-ooxml" % "3.9",
"org.joda" % "joda-money" % "0.9",
"org.pegdown" % "pegdown" % "1.4.2",
"org.planet42" %% "laika-core" % "0.5.0",
"org.jsoup" % "jsoup" % "1.7.3",
// update selenium to avoid browser test to hang
"org.seleniumhq.selenium" % "selenium-java" % "2.39.0",
"ws.securesocial" %% "securesocial" % "2.1.3",
"nl.rhinofly" %% "play-s3" % "3.3.3"
)
val main = play.Project(appName, appVersion, appDependencies).settings(scalariformSettings: _*).settings(
resolvers += Resolver.url("heroku-sbt-plugin-releases", url("https://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("sbt-plugin-releases", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("Objectify Play Snapshot Repository", url("http://schaloner.github.com/snapshots/"))(Resolver.ivyStylePatterns),
resolvers += Resolver.url("Objectify Play Repository", url("http://schaloner.github.com/releases/"))(Resolver.ivyStylePatterns),
resolvers += "Rhinofly Internal Repository" at "http://maven-repository.rhinofly.net:8081/artifactory/libs-release-local",
resolvers += Resolver.sonatypeRepo("releases"),
routesImport += "binders._"
).settings(
/* Scalariform: override default settings - no spaces within pattern binders is the only option in IntelliJ IDEA,
preserve spaces before arguments is needed for infix function syntax (unconfirmed).*/
ScalariformKeys.preferences := FormattingPreferences().
setPreference(SpacesWithinPatternBinders, false).
setPreference(RewriteArrowSymbols, true).
setPreference(PreserveSpaceBeforeArguments, true)
// Avoid building Scaladocs and sources to reduce build time.
).settings(sources in(Compile, doc) := Seq.empty
).settings(publishArtifact in(Compile, packageDoc) := false
).settings(publishArtifact in(Compile, packageSrc) := false)
}
I tried several versions of the plugin (not only 0.1.5, but 0.1.4 and 0.1.3 also) without any success. Did anyone have this issue?
Try
"com.heroku" %% "sbt-heroku" % "0.1.5"
also, you should have added the following lines to your plugins/plugins.sbt file
resolvers += Resolver.url("heroku-sbt-plugin-releases",
url("https://dl.bintray.com/heroku/sbt-plugins/"))(Resolver.ivyStylePatterns)
addSbtPlugin("com.heroku" % "sbt-heroku" % "0.1.5")

Phantom Cassandra driver dependency error

I would like to use the phantom cassandra wrapper in my scala project, but when I try to update my sbt build I get a dependency error.
My build.sbt:
version := "1.0"
scalaVersion := "2.11.2"
seq(lsSettings :_*)
libraryDependencies ++= Seq(
"org.clapper" %% "grizzled-scala" % "1.2",
"commons-io" % "commons-io" % "2.4",
"org.rauschig" % "jarchivelib" % "0.6.0",
"com.google.code.findbugs" % "jsr305" % "3.0.0",
"org.scalatest" % "scalatest_2.11" % "2.2.0" % "test",
"com.github.nscala-time" %% "nscala-time" % "1.2.0",
"org.json4s" %% "json4s-native" % "3.2.10",
"org.scala-lang" % "scala-library" % "2.11.2",
"com.websudos" % "phantom-dsl_2.10" % "1.2.0"
)
resolvers += "grizzled-scala-resolver-0" at "https://oss.sonatype.org/content/repositories/releases"
resolvers += "Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/"
I get the following error:
[warn] Note: Some unresolved dependencies have extra attributes. Check that these dependencies exist with the requested attributes.
[warn] com.typesafe.sbt:sbt-pgp:0.8.1 (sbtVersion=0.13, scalaVersion=2.10)
Don't know what I have to do...
edit:
Answer from https://github.com/websudosuk/phantom/issues/119
error is on the pom side, new version 1.2.1 coming soon...
Answer from https://github.com/websudosuk/phantom/issues/119
error is on the pom side, new version 1.2.1 coming soon...