IDEA 15 cannot resolve build.sbt after create SBT project - scala

As the title, I've tried most solutions on the internet, but it still not work.
But I can still load my old SBT projects!
It just can't create a new one.
Remove .lock file under ~./ivy2 and ~/.sbt => not work
Change sbt and scala version (Current version is SBT 13.9, Scala 2.11.7) => not work
Invalidate cache and restart => not work
Set SDK/Java path => not work
Reinstall => not work
Does anyone know what's going on?
01:01:48 SBT project import
[warn] [FAILED ] org.scala-sbt#compiler-interface;0.13.9!compiler-interface.jar(src): (0ms)
[warn] ==== typesafe-ivy-releases: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== sbt-plugin-releases: tried
[warn] https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== local: tried
[warn] /Users/WeiChen/.ivy2/local/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== activator-local: tried
[warn] /Users/WeiChen/activator-dist-1.3.6/repository/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== activator-launcher-local: tried
[warn] /Users/WeiChen/.activator/repository/org.scala-sbt/compiler-interface/0.13.9/srcs/compiler-interface-sources.jar
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/org/scala-sb..

It seems like a bug on IDEA 15, I temporally downgrade to IDEA 14 to avoid this problem.

Try re-importing the project.
Select your build.sbt from the tree, then in the following dialog, make sure Sources for SBT and plugins is ticked.

Related

SBT Dependency Resolution Failure with vespa.ai

I've added Vespa to an sbt project:
libraryDependencies += "com.yahoo.vespa" % "vespa-http-client" % "6.225.3"
Which results in the following module resolution failure:
[warn] Detected merged artifact: [FAILED ] com.yahoo.vespa#component;6.225.3!component.container-plugin: (0ms).
[warn] Detected merged artifact: [FAILED ] com.yahoo.vespa#vespajlib;6.225.3!vespajlib.container-plugin: (0ms).
[warn] ==== local: tried
[warn] ==== local: tried
[warn] ==== public: tried
[warn] ==== public: tried
[warn] ==== local-preloaded-ivy: tried
[warn] https://repo1.maven.org/maven2/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin
[warn] C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\vespajlib\6.225.3\container-plugins\vespajlib.container-plugin
[warn] ==== local-preloaded-ivy: tried
[warn] ==== local-preloaded: tried
[warn] C:\Users\gary\.sbt\preloaded\com.yahoo.vespa\component\6.225.3\container-plugins\component.container-plugin
[warn] file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/vespajlib/6.225.3/vespajlib-6.225.3.container-plugin
[warn] ==== local-preloaded: tried
[warn] file:/C:/Users/gary/.sbt/preloaded/com/yahoo/vespa/component/6.225.3/component-6.225.3.container-plugin
Failed with both an older version and latest sbt (1.1.1).
SBT uses the artifact's packaging type as file extension by default. Our pom.xml for the component artifact (and quite a few others) uses packaging type container-plugin, while the actual jar file of course has the standard jar suffix.
So you need to configure SBT manually with the file suffix for those artifacts. I don't know if there's a convenient way to do this for a set of dependencies at once, as I'm not an SBT expert. But for each individual artifact where you get this error, you could try the following:
libraryDependencies += "com.yahoo.vespa" % "component" % "6.225.3" artifacts( Artifact("component", "", "jar"))
I found it in this SO answer and haven't tested it myself. Perhaps you can find some useful information in the SBT reference manual on Using dependencies with artifacts.
Here are the dependencies of vespa-http-cient:
https://github.com/vespa-engine/vespa/blob/master/vespa-http-client/pom.xml
I don't know SBT very well, maybe you need to explicitly include those dependencies, or specify to include transitive dependencies.

activator dist failing when using Scala 2.12.0

I updated the scala version in my build.sbt file to 2.12.0 from 2.11.8.
scalaVersion := "2.12.0"
But now activator dist is failing with the following errors. Please advise:
[info] Resolving com.typesafe.play#twirl-api_2.12;1.1.1 ...
[warn] module not found: com.typesafe.play#twirl-api_2.12;1.1.1
[warn] ==== local: tried
[warn] /home/ubuntu/.ivy2/local/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/typesafe/play/twirl-api_2.12/1.1.1/twirl-api_2.12-1.1.1.pom
[warn] ==== activator-launcher-local: tried
[warn] /home/ubuntu/activator/repository/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
[warn] ==== typesafe-releases: tried
[warn] https://repo.typesafe.com/typesafe/releases/com/typesafe/play/twirl-api_2.12/1.1.1/twirl-api_2.12-1.1.1.pom
[warn] ==== typesafe-ivy-releasez: tried
[warn] https://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.play/twirl-api_2.12/1.1.1/ivys/ivy.xml
One of your dependencies (twirl-api) has not been released for Scala 2.12. You need to remove this dependency, get it published on 2.12, or else stay on Scala 2.11.

Unable to resolve scalajs-sbt-plugin dependency

I just tried to clone https://github.com/scala-js/scalajs-tutorial and I get this:
[info] Resolving org.scala-lang.modules.scalajs#scalajs-sbt-plugin;0.5.5 ...
[warn] module not found: org.scala-lang.modules.scalajs#scalajs-sbt-plugin;0.5.5
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/org.scala-lang.modules.scalajs/scalajs-sbt-plugin/scala_2.10/sbt_0.13/0.5.5/ivys/ivy.xml
[warn] ==== sbt-plugin-releases: tried
[warn] http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-lang.modules.scalajs/scalajs-sbt-plugin/scala_2.10/sbt_0.13/0.5.5/ivys/ivy.xml
[warn] ==== local: tried
[warn] C:\Users\Joan\.ivy2\local\org.scala-lang.modules.scalajs\scalajs-sbt-plugin\scala_2.10\sbt_0.13\0.5.5\ivys\ivy.xml
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/scala-lang/modules/scalajs/scalajs-sbt-plugin_2.10_0.13/0.5.5/scalajs-sbt-plugin-0.5.5.pom
I also opened an issue here
Cheers
Qote from https://github.com/scala-js/scalajs-tutorial/issues/3:
This resolver is supposed to be used by default by sbt >= 0.13.0.
And this has all been working fine for a year. Now suddenly people start having this issue :-s This doesn't make any sense.
Workaround: add explicitly the following resolver in project/plugins.sbt:
resolvers += Resolver.url(
"bintray-sbt-plugin-releases",
url("https://dl.bintray.com/content/sbt/sbt-plugin-releases")
)(Resolver.ivyStylePatterns)

Local dependencies resolved by SBT but not by Play! Framework

I'm trying to use banana-RDF, a locally published library (published using SBT's publish-local) from a Play! Framework project, but when running compile from Play's console, the wanted library is not resolved, when using compile from SBT's console everything goes fine.
I find this behavior pretty weird as Play uses SBT to resolve dependencies. By the way, I'm using the 0.12.3 version of SBT in my Play project.
The error I'm getting when compiling with Play is pretty basic:
[warn] module not found: org.w3#banana_2.10;2013_02_21-SNAPSHOT
[warn] ==== local: tried
[warn] /home_local/.installedSoftware/play-2.1.1/repository/local/org.w3/banana_2.10/2013_02_21-SNAPSHOT/ivys/ivy.xml
[warn] ==== Typesafe Releases Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Typesafe Snapshots Repository: tried
[warn] http://repo.typesafe.com/typesafe/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Akka Snapshots: tried
[warn] http://repo.akka.io/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== OSS117: tried
[warn] http://oss.sonatype.org/content/repositories/snapshots/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local Maven Repository: tried
[warn] file:///home_local/.m2/repository/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== Local SBT Repository: tried
[warn] file:///home_local/.ivy2/local/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/org/w3/banana_2.10/2013_02_21-SNAPSHOT/banana_2.10-2013_02_21-SNAPSHOT.pom
Can anyone explain what is happening here? Thank you in advance.
The problem is that SBT's publish-local publishes your library to ~/.ivy2/local, whereas Play seems to have his ivy2 local repository pointer to the ivy2 repository of his own installation folder (your /home_local/.installedSoftware/play-2.1.1/repository/local).
You can add for example this resolver to your Play's Build.scala:
resolvers += Resolver.file("Local repo", file(System.getProperty("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)

SBT + Lift - Not being able to build with sbteclipse

I just installed SBT 0.10.1.
I'm using Lift 2.4-M3
I can build with Scala 2.9.0-1 but when it tries to search for sbteclipse it just hangs:
[warn] module not found: com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/ivys/ivy.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/jars/sbteclipse_2.9.0-1.jar
[warn] ==== local: tried
[warn] /Users/JP/.ivy2/local/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/ivys/ivy.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] /Users/JP/.ivy2/local/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/jars/sbteclipse_2.9.0-1.jar
[warn] ==== Typesafe Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/0.10.1/1.2/ivys/sbteclipse_2.9.0-1-1.2.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo.typesafe.com/typesafe/releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/0.10.1/1.2/jars/sbteclipse_2.9.0-1-1.2.jar
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.pom
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo1.maven.org/maven2/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.pom
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://scala-tools.org/repo-releases/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[warn] :: problems summary ::
[warn] :::: WARNINGS
[warn] module not found: com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2
[warn] ==== typesafe-ivy-releases: tried
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/ivys/ivy.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo.typesafe.com/typesafe/ivy-releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/jars/sbteclipse_2.9.0-1.jar
[warn] ==== local: tried
[warn] /Users/JP/.ivy2/local/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/ivys/ivy.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] /Users/JP/.ivy2/local/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/1.2/jars/sbteclipse_2.9.0-1.jar
[warn] ==== Typesafe Repository: tried
[warn] http://repo.typesafe.com/typesafe/releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/0.10.1/1.2/ivys/sbteclipse_2.9.0-1-1.2.xml
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo.typesafe.com/typesafe/releases/com.typesafe.sbteclipse/sbteclipse_2.9.0-1/0.10.1/1.2/jars/sbteclipse_2.9.0-1-1.2.jar
[warn] ==== public: tried
[warn] http://repo1.maven.org/maven2/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.pom
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://repo1.maven.org/maven2/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.jar
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn] http://scala-tools.org/repo-releases/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.pom
[warn] -- artifact com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2!sbteclipse_2.9.0-1.jar:
[warn] http://scala-tools.org/repo-releases/com/typesafe/sbteclipse/sbteclipse_2.9.0-1/1.2/sbteclipse_2.9.0-1-1.2.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[info]
[info] :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
[error] {file:/Users/JP/.sbt/plugins/}default-05868e/*:update: sbt.ResolveException: unresolved dependency: com.typesafe.sbteclipse#sbteclipse_2.9.0-1;1.2: not found
The steps I made:
Put the sbteclipse build.sbt in ~/.sbt/plugins/
Added scalaVersion := "2.9.0-1" to ~/.sbt/plugins/build.sbt because, for some reason, sbt was always building with Scala 2.8.1
Copy&Paste Lift scala_29/lift_basic to my project root
Added build.sbt to both project root and /project/plugins/ like stated in http://www.assembla.com/spaces/liftweb/wiki/Using_SBT
Changed build.properties sbt.version=0.7.7 to sbt.version=0.10.1
Any ideas on how to have this building properly?
Do I need to add any code from the https://github.com/typesafehub/sbteclipse ?
Thank you.
Just found the solution.
First things first, like Daniel said, you cannot have scalaVersion in ~/.sbt/plugins/build.sbt
Just remove it form there.
Secondly I updated sbteclipse build.sbt from https://github.com/typesafehub/sbteclipse
Thirdly I copied the content from /project/plugins/build.sbt and added it to ~/.sbt/plugins/build.sbt
Finally I cleaned everything from previous builds and ran sbt. It compiled with no errors whatsoever.
You shouldn't have added scalaVersion := "2.9.0-1" to ~/.sbt/plugins/build.sbt. SBT uses Scala 2.8.1 for itself, and that includes any plugins (such as sbteclipse).
You may add that to your project -- as in build.sbt in the root of your project, not project/plugin/build.sbt --, so that it uses Scala 2.9.0-1, but SBT, and sbteclipse, will continue to use Scala 2.8.1.
Again, SBT and its plugins must use SBT's Scala version, which, at the moment, is 2.8.1.