Ser*_*gey 7 java scala sbt web
我试图为现有的Scala项目调整sbt版本是不成功的,该项目之前工作正常,但任何文档都被遗弃了.似乎替换了错误的URL来解决"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
Run Code Online (Sandbox Code Playgroud)
my_project/build.sbt:
name := "my_project"
organization := "my.app"
version := "1.0"
scalaVersion := "2.10.2"
...
libraryDependencies += ...
Run Code Online (Sandbox Code Playgroud)
C:\ Users\svc\.sbt\repositories:
[repositories]
local
maven-central
typesafe: http://repo.typesafe.com/typesafe/releases/
typesafe-snapshots: http://repo.typesafe.com/typesafe/snapshots/
Run Code Online (Sandbox Code Playgroud)
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")
Run Code Online (Sandbox Code Playgroud)
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
Run Code Online (Sandbox Code Playgroud)
日志显示:
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
...
Run Code Online (Sandbox Code Playgroud)
真的 - 我可以在http://repo.typesafe.com/typesafe/releases/org.scala-sbt/sbt/0.13.5/jars/sbt.jar上看到"sbt" 但是URL上没有它是由框架生成的:
在http://repo1.maven.org/maven2/org/scala-sbt/sbt/0.13.5/sbt-0.13.5.jar或http://repo.typesafe.com/typesafe/releases/org/阶-SBT/SBT/0.13.5/SBT-0.13.5.jar
谁有人建议?
小智 17
尝试安装ssl证书.您可以尝试使用以下命令.它帮助我解决了同样的问题.(Ubuntu 15.04)
update-ca-certificates -f
Run Code Online (Sandbox Code Playgroud)
您是否尝试删除该~/.sbt/repositories文件?默认值应该足够了。
如果这仍然不起作用,请尝试将您的 sbt 启动器更新到最新版本。
另外一个好的做法是build.properties在my_project/project目录中有一个包含该行的文件:
sbt.version=0.13.6
Run Code Online (Sandbox Code Playgroud)
这将强制项目的 sbt 版本,而不是使用启动器的版本。
最新的可行变体。
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 += ...
Run Code Online (Sandbox Code Playgroud)
C:\Users\svc\ .sbt\repositories - 已删除
将sbt-launch.jar放在C:\Program Files (x86)\sbt\bin中
将build.properties放入my_project/project文件夹中,其中包含该行:
sbt.version=0.13.6
Run Code Online (Sandbox Code Playgroud)
(什么版本 - 没关系,它适用于任何 0.13.~ 版本 - 我检查过)
将plugins.sbt放入C:\Users\svc.sbt\0.13\plugins文件夹中,其中包含以下行:
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")
Run Code Online (Sandbox Code Playgroud)
删除了C:\Users\svc\ .sbt\0.13.5
将sbtconfig.txt放在C:\Program Files (x86)\sbt\conf目录中,其中包含以下行:
# 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
Run Code Online (Sandbox Code Playgroud)
如果某些工件被放置在公司封闭网络中(就像我一样),您应该运行sbt两次 - 使用 2 个不同的代理(已注释/未注释)。
| 归档时间: |
|
| 查看次数: |
15559 次 |
| 最近记录: |