sbt build failed - 找不到模块:org.scala-sbt#sbt; 0.13.5

时间:2014-11-18 19:30:21

标签: java scala web sbt

我试图为现有的Scala项目调整sbt构建失败,该项目之前工作正常,但任何文档都被遗弃了。似乎替换了错误的网址以解决" sbt.jar" ...

的依赖性

my_project 目录中

ear
    application.xml
    web-logic-application.xml
project
    target
      config-classes
        *.class
src
    main
      java
        package(java-utils)
      scala
        package(scala)
        my_app.properties
        spring.xml
        ...
      webapp
        WEB-INF
          web.xml
    test
      scala
      resources
 build.sbt

MY_PROJECT / build.sbt

name := "my_project"

organization := "my.app"

version := "1.0"

scalaVersion := "2.10.2"
...
libraryDependencies += ...

C:\ Users \ svc \ .sbt \ repositories

[repositories]
local

maven-central

typesafe: http://repo.typesafe.com/typesafe/releases/

typesafe-snapshots: http://repo.typesafe.com/typesafe/snapshots/

C:\ Users \ svc \ .sbt \ 0.13.5 \ plugins \ plugins.sbt

resolvers += "typesave" at "http://repo.typesafe.com/typesafe/releases"

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.5.0")

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.2")

C:\ Program Files(x86)\ sbt \ conf \ sbtconfig.txt (在本地PC安装sbt后没有更改):

# Set the java args to high */

-Xmx512M

-XX:MaxPermSize=256m

-XX:ReservedCodeCacheSize=128m



# Set the extra SBT options */

-Dsbt.log.format=true

日志显示:

Getting org.scala-sbt sbt 0.13.5 ...

:: problems summary ::
:::: WARNINGS
        module not found: org.scala-sbt#sbt;0.13.5

    ==== local: tried

      C:\Users\svc\.ivy2\local\org.scala-sbt\sbt\0.13.5\ivys\ivy.xml

      -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar:

      C:\Users\svc\.ivy2\local\org.scala-sbt\sbt\0.13.5\jars\sbt.jar

    ==== Maven Central: tried

      http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom

      -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar:

      http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar

    ==== typesafe: tried

      http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom

      -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar:

      http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar

        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

        ::::::::::::::::::::::::::::::::::::::::::::::

        :: org.scala-sbt#sbt;0.13.5: not found

        ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
    Server access Error: Connection refused: connect url=http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom

    Server access Error: Connection refused: connect url=http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar

    Server access Error: Connection refused: connect url=http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.pom

    Server access Error: Connection refused: connect url=http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar
...

真的 - 我可以看到" sbt"超过http://repo.typesafe.com/typesafe/releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jar 但它不存在于URL由框架生成:

over http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar 或者超过http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar

有人可以建议吗?

3 个答案:

答案 0 :(得分:16)

尝试安装ssl证书。您可以尝试使用以下命令。它帮助我解决了同样的问题。 (Ubuntu 15.04)

update-ca-certificates -f

答案 1 :(得分:4)

您是否尝试删除~/.sbt/repositories文件?默认值应该足够了。

如果仍然无效,请尝试将sbt启动器更新为最新版本。

同样,good practicebuild.properties目录中的文件my_project/project,其中包含该行:

sbt.version=0.13.6

这将强制执行项目的sbt版本,而不是使用启动器的版本。

答案 2 :(得分:2)

最新的可行变体。

my_project \ build.sbt 看起来像这样:

name := "my_project"

organization := "my.app"

version := "1.0"

scalaVersion := "2.10.2"

resolvers ++= Seq[sbt.Resolver](
    "Local Maven Repository@wildfly" at "file:///M:/",
    "Local Maven Repository@common" at "file:///" + Path.userHome.absolutePath + "/.m2/repository"
)

seq(webSettings :_*)
...
libraryDependencies += ...

C:\ Users \ svc \ .sbt \ repositories - 已删除

C:\ Program Files(x86)\ sbt \ bin

中放置 sbt-launch.jar

my_project / project 文件夹中放置 build.properties ,其中包含该行:

sbt.version=0.13.6

(什么版本 - 没关系,它适用于任何0.13。〜版本 - 我检查过)

C:\ Users \ svc.sbt \ 0.13 \ plugins 文件夹中放置 plugins.sbt ,其中包含以下行:

resolvers += "typesave" at "http://repo.typesafe.com/typesafe/releases"

addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.3.0")

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.4.2")

删除 C:\ Users \ svc \ .sbt \ 0.13.5

C:\ Program Files(x86)\ sbt \ conf 目录中放置 sbtconfig.txt ,其中包含以下行:

# Set the java args to high
-Xms1G
-Xmx2G
-XX:MaxPermSize=512m
-XX:ReservedCodeCacheSize=128m
# Set the extra SBT options
-DproxySet=true
-Dsbt.log.format=true

#-Dhttp.proxyHost=my-proxy-in.com
#-Dhttp.proxyPort=8080
#-Dhttps.proxyHost=my-proxy-in.com
#-Dhttps.proxyPort=8080
#-Dhttp.proxyUser=my_user
#-Dhttp.proxyPassword="my_psw"

-Dhttp.proxyHost=my-proxy-out.com
-Dhttp.proxyPort=8080
-Dhttps.proxyHost=my-proxy-out.com
-Dhttps.proxyPort=8080

如果某些文物放置在公司封闭网络中(就像我这样),您应该运行 sbt 两次 - 使用2个不同的代理(注释/取消注释)。