Search code examples
scalasbtrhino

Using Mozilla Rhino with SBT - Unknown artifact


I am trying to add Mozilla Rhino to my SBT project but it fails to fetch. More specifically I get an error:

Unknown artifact. Not resolved or indexed

name := "JsCFA-prototype"

version := "1.0"

scalaVersion := "2.11.7"

resolvers += "jabylon Repository" at "http://www.jabylon.org/maven/"

libraryDependencies += "org.mozilla" %% "javascript" % "1.7.2"

Maven Central link:

https://mvnrepository.com/artifact/org.mozilla/javascript/1.7.2

enter image description here


Solution

  • There is a slight difference between what you wrote:

    libraryDependencies += "org.mozilla" %% "javascript" % "1.7.2"
    

    and whaא's written in Maven:

    libraryDependencies += "org.mozilla" % "javascript" % "1.7.2"
    

    The difference is that %% is looking for Scala packages, and adds suffix of "_2.11" (according to the Scala version you are running). If you are using single % it is being fetched as it is.

    So basically what you are asking for is equivalent to:

    libraryDependencies += "org.mozilla" % "javascript_2.11" % "1.7.2"
    

    Which does not exist, as sbt reflected.