Greg Greg - 3 months ago 22
Scala Question

Why is sbt-scapegoat trying to resolve version 1.0.0?

I'm trying to use sbt-scapegoat by adding this to plugins.sbt:

addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4")


Then in by build.scala file I'm doing this:

import com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin.autoImport._
scapegoatVersion := "1.1.0"


This is what's shown on the sbt-scapegoat github site. I fire up sbt and let it resolve sbt-scapegoat 1.0.4, which it does. So far so good. Then if I run scapegoat I get:

[info] Resolving com.sksamuel.scapegoat#scalac-scapegoat-plugin_2.10;1.0.0 ...
[warn] Host repo1.maven.org not found. url=https://repo1.maven.org/maven2/com/sksamuel/scapegoat/scalac-scapegoat-plugin_2.10/1.0.0/scalac-scapegoat-plugin_2.10-1.0.0.pom
[info] You probably access the destination server through a proxy server that is not well configured.
[warn] module not found: com.sksamuel.scapegoat#scalac-scapegoat-plugin_2.10;1.0.0
[warn] ==== local: tried
[warn] /Users/wmy965/.ivy2/local/com.sksamuel.scapegoat/scalac-scapegoat-plugin_2.10/1.0.0/ivys/ivy.xml
[warn] ==== public: tried
[warn] https://repo1.maven.org/maven2/com/sksamuel/scapegoat/scalac-scapegoat-plugin_2.10/1.0.0/scalac-scapegoat-plugin_2.10-1.0.0.pom
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: com.sksamuel.scapegoat#scalac-scapegoat-plugin_2.10;1.0.0: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::


Where is 1.0.0 dependency coming from? My project is scala 2.11.7 and I'm using sbt 0.13.11. I don't see any mention of another resolver on the sbt-scapegoat web site.

In my output, my console shows a bunch of found analysis errors but the generated HTML doc is basically empty--doesn't show the errors displayed on the console.

How can I fix this?

Answer

To set scapegoatVersion for subprojects, you need to either put it in common settings as described here, or use scapegoatVersion in ThisBuild := "1.1.0". To avoid the error, I think setting scalaVersion in the root project would work:

lazy val root = (project in file(".")).
  aggregate(dotdash, dotdash_messages).
  settings(
    scalaVersion := "2.11.7"
  )

or again use scalaVersion in ThisBuild.

I also suggest raising an issue at https://github.com/sksamuel/sbt-scapegoat.