I am getting the following error when I build a library bp-kafka-bp2 that depends on library bp-bp2-componentized:
sbt.librarymanagement.ResolveException: unresolved dependency:
com.foo#bp-bp2-componentized_2.11;3.3.+: configuration not found in
com.foo#bp-bp2-componentized_2.11;3.3.0: 'master'. It was required
from com.foo#bp-kafka-bp2_2.11;3.10.1 compile
The unresolved library bp-bp2-componentized does in fact exist in ~/.ivy2/local and does not have a master configuration in its ivy.xml
My questions are:
Should the dependent library (bp-kafka-bp2) be looking for a master configuration of the (not really) missing library?
If it should not be looking for a master config, what can I do to make it stop doing so?
If it should be looking for a master config, how do I induce the build for the (not really) missing library to produce such a config?
I have tried this in sbt versions 1.1.5 and 1.2.1. I have deleted ~/.ivy2/local, ./ivy2/cache and ~/.sbt. I have also removed all the /target and project/target directories in the library I am building and done sbt clean
This library has built just fine for a year or two now. The only recent change I can think of is introducing 2.11 and 2.12 cross-compilation option -- which is not being exercised here, I'm just building 2.11 version on its own.
The direct dependency is declared in a multi-project build.sbt as
lazy val bp2 = (project in file("bp2")).
settings(commonSettings:_*).
settings(Seq(
name := "bp-kafka-bp2"
):_*).
settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % ScalaTestVersion % "test",
"ch.qos.logback" % "logback-classic" % LogbackVersion % "test",
"com.foo" %% "bp-bp2-componentized" % Constellation.dependency("bp-bp2"),
"com.foo" %% "bp-akka-http" % Constellation.dependency("bp-akka")
)
).
dependsOn(reactiveComponentized)
where Constellation.dependency is just a function that looks up a version by name and turns it into a patch range:
object Constellation {
...
def dependency(name: String) : String = versions(name).split("\\.").dropRight(1).mkString(".") + ".+"
}
You can see from the error message that the version is being found and converted to 3.3.+ which is then resolved correctly to a 3.3.0 in the ivy cache. But then it insists on finding a master configuration which is not present.
Here is my sbt file myproject/build.sbt
version := "1.0"
scalaVersion := "2.12.1"
libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.16",
"io.circe" %% "circe-core" % "0.6.1",
"io.circe" %% "circe-generic" % "0.6.1",
"io.circe" %% "circe-parser" % "0.6.1"
)
Here is my scala file myproject/src/test.scala
package mytest
import akka._
object test {
def main(args: Array[String]) {
print(2)
}
}
I verified that my external library contains, akka
but intellij keep saying that
Error:(7, 8) not found: object akka
import akka._
I am using intellij community edition 2016.3 with the latest scala plugin (which should include latest sbt)
Can someone give me a hint on how to resolve this?
To fix the problem, you have to place your Scala source file into src/main/scala directory. Otherwise IntelliJ/SBT can't recognize it as file related to the project, so it can't associate project dependencies with it.
By default Scala source files can be placed either in the root directory of your project, or in src/main/scala (for main sources, there is also src/test/scala for tests).
If you want to use some other directories to store your Scala source files, you can configure it this way in your build.sbt:
sourceDirectories in Compile += new File("src")
I had a similar problem and it was nothing to do with the directory structure in my case. IntelliJ asks you to refresh when you add a new dependency in build.sbt. I also manually refreshed it form the SBT Shell and still same error.
In the end I closed the project and re-opened and it was fixed.
I have a Scala project that I build with sbt. It uses the sryza/spark-timeseries library.
I am trying to run the following simple code:
val tsAirPassengers = new DenseVector(Array(
112.0,118.0,132.0,129.0,121.0,135.0,148.0,148.0,136.0,119.0,104.0,118.0,115.0,126.0,
141.0,135.0,125.0,149.0,170.0,170.0,158.0,133.0,114.0,140.0,145.0,150.0,178.0,163.0,
172.0,178.0,199.0,199.0,184.0,162.0,146.0,166.0,171.0,180.0,193.0,181.0,183.0,218.0,
230.0,242.0,209.0,191.0,172.0,194.0,196.0,196.0,236.0,235.0,229.0,243.0,264.0,272.0,
237.0,211.0,180.0,201.0,204.0,188.0,235.0,227.0,234.0,264.0,302.0,293.0,259.0,229.0,
203.0,229.0,242.0,233.0,267.0,269.0,270.0,315.0,364.0,347.0,312.0,274.0,237.0,278.0,
284.0,277.0,317.0,313.0,318.0,374.0,413.0,405.0,355.0,306.0,271.0,306.0,315.0,301.0,
356.0,348.0,355.0,422.0,465.0,467.0,404.0,347.0,305.0,336.0,340.0,318.0,362.0,348.0,
363.0,435.0,491.0,505.0,404.0,359.0,310.0,337.0,360.0,342.0,406.0,396.0,420.0,472.0,
548.0,559.0,463.0,407.0,362.0,405.0,417.0,391.0,419.0,461.0,472.0,535.0,622.0,606.0,
508.0,461.0,390.0,432.0
))
val period = 12
val model = HoltWinters.fitModel(tsAirPassengers, period, "additive", "BOBYQA")
It builds fine, but when I try to run it, I get this error:
Exception in thread "main" java.lang.NoSuchMethodError: scala.runtime.IntRef.create(I)Lscala/runtime/IntRef;
at com.cloudera.sparkts.models.HoltWintersModel.convolve(HoltWinters.scala:252)
at com.cloudera.sparkts.models.HoltWintersModel.initHoltWinters(HoltWinters.scala:277)
at com.cloudera.sparkts.models.HoltWintersModel.getHoltWintersComponents(HoltWinters.scala:190)
.
.
.
The error occurs on this line:
val model = HoltWinters.fitModel(tsAirPassengers, period, "additive", "BOBYQA")
My build.sbt includes:
name := "acme-project"
version := "0.0.1"
scalaVersion := "2.10.5"
libraryDependencies ++= Seq(
"org.apache.spark" %% "spark-hive" % "1.6.0",
"net.liftweb" %% "lift-json" % "2.5+",
"com.github.seratch" %% "awscala" % "0.3.+",
"org.apache.spark" % "spark-mllib_2.10" % "1.6.2"
)
I have placed sparkts-0.4.0-SNAPSHOT.jar in the lib folder of my project. (I would have preferred to add a libraryDependency, but spark-ts does not appear to be on Maven Central.)
What is causing this run-time error?
The library requires Scala 2.11, not 2.10, and Spark 2.0, not 1.6.2, as you can see from
<scala.minor.version>2.11</scala.minor.version>
<scala.complete.version>${scala.minor.version}.8</scala.complete.version>
<spark.version>2.0.0</spark.version>
in pom.xml. You can try changing these and seeing if it still compiles, find which older version of sparkts is compatible with your versions, or update your project's Scala and Spark versions (don't miss spark-mllib_2.10 in this case).
Also, if you put the jar into lib folder, you also have to put its dependencies there (and their dependencies, etc.) or into libraryDependencies. Instead, publish sparkts into your local repository using mvn install (IIRC) and add it to libraryDependencies, which will allow SBT to resolve its dependencies.
I am new to scala and am currently trying to setup IntelliJ IDEA 13.1 with the Scala plugin. It has support for SBT. I have simply followed the basic tutorial for creating a new project for SBT here: http://confluence.jetbrains.com/display/IntelliJIDEA/Getting+Started+with+SBT
Currently my build.sbt file is:
name := "scalasandpit"
version := "1.0"
scalaVersion := "2.10"
libraryDependencies += "org.scalatest" % "scalatest_2.10" % "2.1.0" % "test"
autoAPIMappings := true
This pulls down various jar binaries, but no sources and no javadoc. I wondered if there is a way to have both sources and javadoc work with IntelliJ and SBT. I think I'm missing something.
There seem to be two issues: getting sbt to pull down sources and docs, and then getting Idea to show them to you. To solve the former problem see the sbt documentation -- about half way down there's a section called "Download Sources" which tells you what to add to your build.sbt:
libraryDependencies +=
"org.scalatest" % "scalatest_2.10" % "2.1.0" % "test" withSources() withJavadoc()
I'm new in playFrameWork
I'm trying to figure out how the build.sbt file works in play framework 2.2
i'm also trying to make the secureSocial plugin works
In the sample app of the plugin secureSocial, there is a built.scala containing :
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "SecureTestApp"
val appVersion = "1.0"
val appDependencies = Seq(
"ws.securesocial" %% "securesocial" % "master-SNAPSHOT"
)
val main = play.Project(appName, appVersion, appDependencies).settings(
resolvers += Resolver.sonatypeRepo("snapshots")
)
}
Whith the command play run, everything wrok fine and the page is showing itself
AnyWay, as i understand it, i should be able to delete project/built.scala and replace it by /build.sbt. i think my file is ok and look like this :
name := "SecureTestApp"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
"securesocial" %% "securesocial" % "master-SNAPSHOT"
)
resolvers += Resolver.url("Scala Sbt", url("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots"))(Resolver.ivyStylePatterns)
resolvers += Resolver.sonatypeRepo("snapshots")
play.Project.playScalaSettings
This time the play run command work fine the server launch itself but when i launch and test the app homePage,
i get the error : Compilation error "object RuntimeEnvironment is not a member of package securesocial.core"
Play is no longer able to find the package secureSocial. And i don't understand why?
What am i doing wrong?
is there a parametter someWhere to set?
Thanks in advance for any answer!
Edit : whith the line
"ws.securesocial" %% "securesocial" % "2.1.3"
put in both file, play doensn't fine the dependency in both for package secureSocial.
I think the problem is that this object simply does not exist in the version that is published to the repository. If you take a look at the sources, there is no file RuntimeEnvironment.scala in which it is supposed to be defined.
Further if you check the date when the file appeared on github it is 7th May, and the last modified date in the repo shows 23-Jan-2014.
So the bottom line is that your build is working just fine, but the library you're using is not the one that in in the master branch on the github at the moment.
You should rather use the last stable version :
"ws.securesocial" %% "securesocial" % "2.1.3"
and as resolver
resolvers += Resolver.sonatypeRepo("releases")
as master constantly evolves and the doc might not been updated yet.
Major changes have been made on master the 7th May which might break your project if your created it before. (You could also try to clean-all maybe)