SBT代理配置问题 [英] Sbt proxy configuration problems

查看:123
本文介绍了SBT代理配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,似乎我在为SBT配置代理时遇到问题.我尝试了以下方法

So, it seems that I have a problem configuring proxy for SBT. I tried the following methods

  1. 在%SBT_HOME%\ conf \ stbconfig.txt中配置了以下参数:

  1. Configured the following parameters in %SBT_HOME%\conf\stbconfig.txt:

-Dhttp.proxySet=true 
-Dhttp.proxyHost=proxy_server
-Dhttp.proxyPort=proxy_port 
-Dhttp.nonProxyHosts="localhost|127.0.0.1" 
-Dhttp.proxyUser=username
-Dhttp.proxyPassword=password
-Dhttps.proxyHost=proxy_server
-Dhttps.proxyPort=proxy_port 
-Dhttps.nonProxyHosts="localhost|127.0.0.1" 
-Dhttps.proxyUser=username
-Dhttps.proxyPassword=password

  • 我添加了以上参数sbtopts文件,但是没有用.

  • I added the above parameters sbtopts file but didn't work.

    我尝试了说可以在命令行中将配置作为环境变量(JAVA_OPTS或SBT_OPTS)传递的解决方案,但看来这对我没有用.

    I tried the solutions that said to pass the configurations in command line as environment variables ( JAVA_OPTS or SBT_OPTS) but it seems that it didn't worked for me.

    我仍然收到错误(未解决的依赖项)和/或警告([警告]您的代理需要身份验证.)

    I still got errors( Unresolved dependencies) and/or warnings ( [warn] Your proxy requires authentication.)

    我使用Java 1.8.0_131和sbt 1.0.2. Scala版本是:2.12.3.

    I use java 1.8.0_131 and sbt 1.0.2. Scala version is: 2.12.3.

    sbt new scala/hello-world.g8 的输出是:

    Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
    port was removed in 8.0
    [info] Set current project to workspace (in build file:/D:/workspace/)
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  ::          UNRESOLVED DEPENDENCIES         ::
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [warn]  :: org.scala-sbt.sbt-giter8-resolver#sbt-giter8-resolver_2.12;0.1.3: Res
    olution failed several times for dependency: org.scala-sbt.sbt-giter8-resolver#s
    bt-giter8-resolver_2.12;0.1.3 {compile=[default(compile)]}::
    [warn]  sbt-releases-repo: unable to get resource for org.scala-sbt.sbt-giter8-r
    esolver#sbt-giter8-resolver_2.12;0.1.3: res=http://repo.typesafe.com/typesafe/iv
    y-releases/org.scala-sbt.sbt-giter8-resolver/sbt-giter8-resolver_2.12/0.1.3/ivys
    /ivy.xml: java.net.ConnectException: Failed to connect to repo.typesafe.com/34.2
    06.225.108:80
    [warn]  sbt-plugins-repo: unable to get resource for org.scala-sbt.sbt-giter8-re
    solver#sbt-giter8-resolver_2.12;0.1.3: res=http://repo.scala-sbt.org/scalasbt/sb
    t-plugin-releases/org.scala-sbt.sbt-giter8-resolver/sbt-giter8-resolver_2.12/0.1
    .3/ivys/ivy.xml: java.net.ConnectException: Failed to connect to repo.scala-sbt.
    org/34.206.162.65:80
    [warn]  maven-central: unable to get resource for org/scala-sbt/sbt-giter8-resol
    ver#sbt-giter8-resolver_2.12;0.1.3: res=http://repo1.maven.org/maven2/org/scala-
    sbt/sbt-giter8-resolver/sbt-giter8-resolver_2.12/0.1.3/sbt-giter8-resolver_2.12-
    0.1.3.pom: java.net.ConnectException: Failed to connect to repo1.maven.org/151.1
    01.44.209:80
    [warn]  ::::::::::::::::::::::::::::::::::::::::::::::
    [error] java.lang.RuntimeException: Retrieval of org.scala-sbt.sbt-giter8-resolv
    er:sbt-giter8-resolver:0.1.3 failed.
    [error]         at scala.sys.package$.error(package.scala:27)
    [error]         at sbt.TemplateCommandUtil$.classpathForInfo(TemplateCommand.sca
    la:119)
    [error]         at sbt.TemplateCommandUtil$.infoLoader(TemplateCommand.scala:81)
    
    [error]         at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala
    :48)
    [error]         at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateComma
    nd.scala:47)
    [error]         at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.s
    cala:111)
    [error]         at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.
    scala:108)
    [error]         at scala.collection.immutable.List.find(List.scala:86)
    [error]         at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47)
    [error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34
    )
    [error]         at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateC
    ommand.scala:17)
    [error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
    [error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
    [error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
    [error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
    [error]         at sbt.State$$anon$1.runCmd$1(State.scala:227)
    [error]         at sbt.State$$anon$1.process(State.scala:233)
    [error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
    [error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.sc
    ala:16)
    [error]         at sbt.MainLoop$.next(MainLoop.scala:105)
    [error]         at sbt.MainLoop$.run(MainLoop.scala:98)
    [error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
    [error]         at sbt.io.Using.apply(Using.scala:22)
    [error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
    [error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
    [error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
    [error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
    [error]         at sbt.StandardMain$.runManaged(Main.scala:104)
    [error]         at sbt.xMain.run(Main.scala:71)
    [error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
    [error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
    [error]         at xsbt.boot.Launch$.run(Launch.scala:109)
    [error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
    [error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
    [error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
    [error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
    [error]         at xsbt.boot.Boot$.main(Boot.scala:17)
    [error]         at xsbt.boot.Boot.main(Boot.scala)
    [error] Retrieval of org.scala-sbt.sbt-giter8-resolver:sbt-giter8-resolver:0.1.3
     failed.
    

    注意:%USERPROFILE%.sbt \ repositories 的内容是

    [scala]
      version: ${sbt.scala.version-auto}
    
    [app]
      org: ${sbt.organization-org.scala-sbt}
      name: sbt
      version: ${sbt.version-read(sbt.version)[0.13.5]}
      class: ${sbt.main.class-sbt.xMain}
      components: xsbti,extra
      cross-versioned: ${sbt.cross.versioned-false}
    
    [repositories]
      local
      sbt-releases-repo: http://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
      sbt-plugins-repo: http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
      maven-central: http://repo1.maven.org/maven2/
    
    [boot]
      directory: ${sbt.boot.directory-${sbt.global.base-${user.home}/.sbt}/boot/}
    
    [ivy]
      ivy-home: ${sbt.ivy.home-${user.home}/.ivy2/}
      checksums: ${sbt.checksums-sha1,md5}
      override-build-repos: ${sbt.override.build.repos-false}
      repository-config: ${sbt.repository.config-${sbt.global.base-${user.home}/.sbt}/repositories}
    

    推荐答案

    我使用的一种解决方法是设置一个内部工件,该内部工件代理所有远程存储库.

    A workaround that I used was to setup an internal artifactory that proxies all the remote repositories.

    这篇关于SBT代理配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆