What's the proper setup of sbt-idea with sbt 0.11?
Asked Answered
T

2

8

I am creating a Scala project with sbt 0.11.2 and sbt-idea and I am getting UNRESOLVED DEPENDENCIES on the gen-idea task.

I've just installed sbt (downloaded jar and made script as instructed in the wiki), followed the sbt-idea setup here, made an empty directory for my project, and run sbt and then run the gen-idea task.

It can't find the dependency because it only uses the built-in repos. How do I tell sbt to check another repo?


When I place the build.sbt file in the plugins dir and run sbt it starts resolving things, one of which is Resolving com.github.mpeltonen#sbt-idea;0.11.0 ...

Later in the process it downloads it successfully:

[info] downloading http://mpeltonen.github.com/maven/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.jar ...
[info]  [SUCCESSFUL ] com.github.mpeltonen#sbt-idea;0.11.0!sbt-idea.jar (592ms)

When I run the gen-idea task, things look good at first...

> gen-idea
[info] Trying to create an Idea module default-b91f2c

It moves on to creating .idea directories and such, which seem to be created just fine. It then starts resolving things again (scala tools, sbt, commens-*, etc)

Eventually it tries to resolve sbt-idea:

[warn]  module not found: com.github.mpeltonen#sbt-idea;0.11.0
[warn] ==== local: tried
[warn]   /home/scaladev/.ivy2/local/com.github.mpeltonen/sbt-idea/scala_2.9.1/sbt_0.11.2/0.11.0/ivys/ivy.xml
[warn] ==== typesafe-ivy-releases: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/com.github.mpeltonen/sbt-idea/0.11.0/ivys/ivy.xml
[warn] ==== public: tried
[warn]   http://repo1.maven.org/maven2/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[warn] ==== Scala-Tools Maven2 Repository: tried
[warn]   http://scala-tools.org/repo-releases/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[warn] ==== Scala-Tools Maven2 Snapshots Repository: tried
[warn]   http://scala-tools.org/repo-snapshots/com/github/mpeltonen/sbt-idea_2.9.1_0.11.2/0.11.0/sbt-idea-0.11.0.pom
[info] Resolving commons-io#commons-io;2.0.1 ...
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  ::          UNRESOLVED DEPENDENCIES         ::
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn]  :: com.github.mpeltonen#sbt-idea;0.11.0: not found
[warn]  ::::::::::::::::::::::::::::::::::::::::::::::
[warn] 
[warn]  Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn]      com.github.mpeltonen:sbt-idea:0.11.0 (sbtVersion=0.11.2, scalaVersion=2.9.1)
[warn] 

I understand that it wouldn't find it at those locations, but I don't understand why it didn't try the github repo, as it did when configuring the plugin. I was expecting to see a line looking something like this:

[warn] ==== sbt-idea-repo: tried
Trustbuster answered 28/12, 2011 at 22:3 Comment(0)
F
3

gen-idea plugin for sbt 0.11.2 has not yet been published but 0.11.1-SNAPSHOT version should work as expected :

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "0.11.1-SNAPSHOT")
Fee answered 30/12, 2011 at 14:34 Comment(5)
I tried using sbt 0.11.1 and sbt-idea 0.11.1-SNAPSHOT and I get the same results. The errors are the same as above, except with different version numbers of course. The issue still looks to be at the end when it goes to resolve sbt-idea it does not check the github repo, the only place it actually resides.Trustbuster
@JackDreep seems strange as it works for me. Sometimes I've got this kind of error when I can't access the internet but it seems not to be your case. Could you add the trace you get when using sbt 0.11.1 and sbt-idea 0.11.1-SNAPSHOT ?Fee
I'd be happy to add the trace, but I'm not sure what you mean by that. Do you just mean edits I made to the original post, or something more?Trustbuster
@JackDreep yes you could append the trace for the test with 0.11.1-SNAPSHOT to your postFee
I finally got back to this and without thinking I just opened the generated project in idea. It works just fine. The gen-idea task still throws the error listed above, but that does not seem to have any impact on the actual project. Everything works as expected and all libraries are referenced properly. Thanks for your help in looking into this.Trustbuster
D
2

This is documented in the sbt-idea README file here. Specifically:

Add the following lines to ~/.sbt/plugins/build.sbt or PROJECT_DIR/project/plugins.sbt

resolvers += "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "0.11.0")

NOTE: If you experience problems with sbt 0.11 installation, see this.

Dagmar answered 28/12, 2011 at 22:9 Comment(3)
I've tried that and got the same errors. The stackoverflow link I provided actually says to do similar but to put those same lines in ~/.sbt/plugins.sbt. That didn't work either. When I edit the build.sbt file and start sbt it loads things up properly (including things from that github repo) but when I run that gen-idea task I get the dependency problem, where it does not check the repo. I feel like I'm missing another place to register the repo at.Trustbuster
I've just tried it here and it works perfectly for me. What exact error messages are you getting?Dagmar
Thanks for looking at this with me Paul. I've updated the original post with details from the process.Trustbuster

© 2022 - 2024 — McMap. All rights reserved.