未解析的依赖项:SBT中的net.sourceforge.htmlunit

未解析的依赖项:SBT中的net.sourceforge.htmlunit,sbt,htmlunit,Sbt,Htmlunit,我的build.sbt包含以下内容: name := "hello-world" version := "1.0" scalaVersion := "2.10.3" libraryDependencies += "net.sourceforge.htmlunit" %% "htmlunit" % "2.13" 当我在sbt控制台中执行update时,它会显示: [error] (*:update) sbt.ResolveException: unresolved dependency:

我的
build.sbt
包含以下内容:

name := "hello-world"

version := "1.0"

scalaVersion := "2.10.3"

libraryDependencies += "net.sourceforge.htmlunit" %% "htmlunit" % "2.13"
当我在sbt控制台中执行
update
时,它会显示:

[error] (*:update) sbt.ResolveException: unresolved dependency: net.sourceforge.htmlunit#htmlunit_2.10;2.13: not found

我应该怎么做才能让sbt找到这个库?

只需在依赖项中使用一个
%%
而不是两个
%%

libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.13"
%%
仅当jar的路径包含Scala版本时才需要,而Scala版本不是依赖项的情况。我是通过咨询mvnrepository找到的。只需将鼠标悬停在“下载(JAR)”链接上,就可以看到完整的路径

注意:默认情况下,sbt使用标准的Maven2存储库。如果您有在默认repo中找不到的依赖jar,那么您需要添加如下自定义解析器

resolvers += "custom_repo" at "url"

对于这个特定示例,不需要解析程序,因为htmlunit在默认repo中存在。

只需在依赖项中使用一个
%%
而不是两个
%%

libraryDependencies += "net.sourceforge.htmlunit" % "htmlunit" % "2.13"
%%
仅当jar的路径包含Scala版本时才需要,而Scala版本不是依赖项的情况。我是通过咨询mvnrepository找到的。只需将鼠标悬停在“下载(JAR)”链接上,就可以看到完整的路径

注意:默认情况下,sbt使用标准的Maven2存储库。如果您有在默认repo中找不到的依赖jar,那么您需要添加如下自定义解析器

resolvers += "custom_repo" at "url"
对于这个特定的示例,不需要解析程序,因为htmlunit存在于默认repo中