SBT无法通过代理解析依赖关系

时间:2015-08-04 18:49:18

标签: scala proxy sbt

当我运行sbt update时,我收到此错误

    :: problems summary ::
:::: WARNINGS
        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

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

        :: org.scala-sbt#sbt;0.13.8: several problems occurred while resolving dependency: org.scala-sbt#sbt;0.13.8 {default=[default(compile)]}:
    java.util.NoSuchElementException
    java.util.NoSuchElementException

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



:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.8: several problems occurred while resolving dependency: org.scala-sbt#sbt;0.13.8 {default=[default(compile)]}:
    java.util.NoSuchElementException
    java.util.NoSuchElementException
Error during sbt execution: Error retrieving required libraries
  (see /Users/$USER/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.8

我已经设置了使用代理处理curl和homebrew的系统,但由于某种原因,sbt不能使用相同的设置。当我关闭代理时,它会在超时之前挂起几分钟而我没有得到上述错误。

我也试过这个,但没有运气

# export JAVA_FLAGS= -Dhttp.proxyHost=$domain -Dhttp.proxyPort=$portnum -Dhttp.proxyUser=$USER -Dhttp.proxyPassword=$password -Dhttps.proxyHost=$domain -Dhttps.proxyPort=$portnum -Dhttps.proxyUser=$USER -Dhttps.proxyPassword=$password -Dftp.proxyHost=$domain -Dftp.proxyPort=$portnum -Dftp.proxyUser=$USER -Dftp.proxyPassword=$password -Dhttp.nonProxyHosts=$noproxy -Dhttps.nonProxyHosts=$noproxy -Dftp.nonProxyHosts=$noproxy
    # java ${JAVA_FLAGS}

我用来制作hombrew和curl工作的方法是

export http_proxy=$http_proxy
    export https_proxy=$http_proxy
    export ftp_proxy=$http_proxy
    export rsync_proxy=$http_proxy
    export HTTP_PROXY=$http_proxy
    export HTTPS_PROXY=$http_proxy
    export FTP_PROXY=$http_proxy
    export RSYNC_PROXY=$http_proxy

有什么建议吗?

由于

1 个答案:

答案 0 :(得分:0)

我不确定您的JAVA_FLAGS是否包含/导出到类路径,如果不是在尝试此解决方案之前将其添加到类路径中。

我的决心: 我不知道你使用的是哪个IDE,我遇到了同样的问题(我使用的是IntelliJ 14)。如果使用不同的IDE,请尝试与IDE关联,基本上通过VM参数进行设置。

我通过添加vm参数解决了这个问题......

在IntelliJ中添加的步骤:

档案 - >默认设置 - >在构建,执行,部署

构建工具 - > SBT - >

JVM选项 - >像这样的“VM参数”中设置

  

-Dhttp.proxyHost = http://proxy.xxxx.com -Dhttp.proxyPort = 8080 -Dhttps.proxyHost = http://proxy.xxx.com -Dhttps.proxyPort = 8080 -XX:MaxPermSize = 384M -Duser.home = / Users / yourusername / -Dsbt.ivy.home = / Users / yourusername / .ivy2

祝你好运

相关问题