sbt 构建失败 - 找不到模块:org.scala-sbt#sbt;0.13.5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27002423/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 06:42:57  来源:igfitidea点击:

sbt build failed - module not found: org.scala-sbt#sbt;0.13.5

javascalawebsbt

提问by Sergey

I'm unsuccessfully trying to adjust sbt build for the existiing Scala project which previously worked fine but any docs was left. It seems that incorrect URL is substituted to resolve dependancy for "sbt.jar"...

我没有成功尝试为现有的 Scala 项目调整 sbt 构建,该项目以前运行良好,但留下了任何文档。似乎用不正确的 URL 来解决对“sbt.jar”的依赖...

Inside my_projectdir:

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:

my_project/build.sbt

name := "my_project"

organization := "my.app"

version := "1.0"

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

C:\Users\svc\ .sbt\repositories:

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:

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(wasn't changed after sbt installation on local PC):

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

Log shows:

日志显示:

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
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 += ...
.13.5\ivys\ivy.xml -- artifact org.scala-sbt#sbt;0.13.5!sbt.jar: C:\Users\svc\.ivy2\local\org.scala-sbt\sbt
sbt.version=0.13.6
.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 ...

Really - I can see "sbt" over http://repo.typesafe.com/typesafe/releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jarbut it is absent over URL is generated by framework:

真的 - 我可以在http://repo.typesafe.com/typesafe/releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jar 上看到“sbt”, 但它没有通过框架生成的 URL :

over http ://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar or over http://repo.typesafe.com/typesafe/releases/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar

通过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

Can anybody suggest?

有人可以建议吗?

采纳答案by Sergey

The latest workable variant.

最新的可行变体。

my_project\build.sbtlooks like that:

my_project\build.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\repositories- removed

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

Placed sbt-launch.jarin C:\Program Files (x86)\sbt\bin

sbt-launch.jar放在C:\Program Files (x86)\sbt\bin

Placed build.propertiesin the my_project/projectfolder with that line inside:

build.properties放在my_project/project文件夹中,里面有该行:

# 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

(what version is - doesn't matter, it works with any 0.13.~ version - I checked)

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

Placed plugins.sbtin the C:\Users\svc.sbt\0.13\pluginsfolder with that lines inside:

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

update-ca-certificates -f

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

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

Placed sbtconfig.txtin C:\Program Files (x86)\sbt\confdirectory with that lines inside:

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

sbt.version=0.13.6

In case of some artefacts placed in corporate closed network (as it is for me) you should run sbttwice - with 2 different proxies (commented/uncommented).

如果在公司封闭网络中放置了一些人工制品(对我来说是这样),您应该运行sbt两次 - 使用 2 个不同的代理(已注释/未注释)。

回答by shree

Try to install ssl certificates. You can try using the command below. It helped me to solve the same issue. (Ubuntu 15.04)

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

##代码##

回答by Lomig Mégard

Did you try to remove the ~/.sbt/repositoriesfile? The defaults should be enough.

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

If this still not work, try to update your sbt launcher to the last version.

如果这仍然不起作用,请尝试将您的 sbt 启动器更新到最新版本。

Also a good practiceis to have a file build.propertiesin the my_project/projectdirectory with that line inside:

另外一个好的做法build.propertiesmy_project/project目录中有一个包含该行的文件:

##代码##

This will enforce the sbt version for the project, instead of using the version of the launcher.

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