lein repl由于在企业代理后面进行身份验证而失败(Windows 7)

时间:2018-09-03 17:33:37

标签: windows authentication clojure proxy leiningen

运行lein repl时,代理身份验证遇到问题。 我正在使用

> lein --version
    Leiningen 2.8.1 on Java 1.8.0_181 Java HotSpot(TM) 64-Bit Server VM
在Windows 7 64位上为

。我已经设置了http_proxy和https_proxy环境变量。 我通过

安装
> lein self-install

来自powershell。这也存在代理身份验证的问题,但是我能够通过在脚本中调整对powershell的调用来解决此问题(使用$client.Proxy.Credentials = Get-Credential,并调整SecurityProtocolType)。

当我尝试运行lein repl时,我会得到

PS> lein repl
nREPL server started on port 54104 on host 127.0.0.1 - nrepl://127.0.0.1:54104
org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: reply:reply:jar:0.3.7, org.thnetos:cd-client:jar:0.3.6, clj-http-lite:clj-http-lite:jar:0.2.0, cheshire:cheshire:jar:4.0.3, clj-stacktrace:clj-stacktrace:jar:0.2.7, com.cemerick:drawbridge:jar:0.0.6, clj-http:clj-http:jar:0.3.6,
:0.3.7 from/to clojars (https://repo.clojars.org/): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required.
 at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:393)
    sun.reflect.NativeMethodAccessorImpl.invoke0 (:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke (:-1)
    sun.reflect.DelegatingMethodAccessorImpl.invoke (:-1)
    java.lang.reflect.Method.invoke (:-1)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:93)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:28)
    cemerick.pomegranate.aether$resolve_dependencies_STAR_.invokeStatic (aether.clj:806)
    cemerick.pomegranate.aether$resolve_dependencies_STAR_.doInvoke (aether.clj:707)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    cemerick.pomegranate.aether$resolve_dependencies.invokeStatic (aether.clj:815)
    cemerick.pomegranate.aether$resolve_dependencies.doInvoke (aether.clj:809)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    cemerick.pomegranate$add_dependencies.invokeStatic (pomegranate.clj:83)
    cemerick.pomegranate$add_dependencies.doInvoke (pomegranate.clj:57)
    clojure.lang.RestFn.invoke (RestFn.java:457)
    leiningen.repl$client.invokeStatic (repl.clj:261)
    leiningen.repl$client.invoke (repl.clj:258)
    leiningen.repl$repl.invokeStatic (repl.clj:320)
    leiningen.repl$repl.doInvoke (repl.clj:267)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    leiningen.repl$repl.invokeStatic (repl.clj:307)
    leiningen.repl$repl.invoke (repl.clj:267)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invokeStatic (core.clj:648)
    clojure.core$apply.invoke (core.clj:641)
    leiningen.core.main$partial_task$fn__4667.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:648)
    clojure.core$apply.invoke (core.clj:641)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:340)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__4734.invoke (main.clj:420)
    leiningen.core.main$_main.invokeStatic (main.clj:411)
    leiningen.core.main$_main.doInvoke (main.clj:408)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.main$main_opt.invokeStatic (main.clj:314)
    clojure.main$main_opt.invoke (main.clj:310)
    clojure.main$main.invokeStatic (main.clj:421)
    clojure.main$main.doInvoke (main.clj:384)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    clojure.lang.Var.invoke (Var.java:388)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: The following artifacts could not be resolved: reply:reply:jar:0.3.7, org.thnetos:cd-client:jar:0.3.6, clj-http-lite:clj-http-lite:jar:0.2.0, cheshire:cheshire:jar:4.0.3, clj-stacktrace:clj-stacktrace:jar:0.2.7, com.cemerick:drawbridge:jar:0.0.6, clj-http:clj-http:ja
reply:jar:0.3.7 from/to clojars (https://repo.clojars.org/): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required.
 at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve (DefaultArtifactResolver.java:453)
    org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts (DefaultArtifactResolver.java:255)
    org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies (DefaultRepositorySystem.java:376)
    sun.reflect.NativeMethodAccessorImpl.invoke0 (:-2)
    sun.reflect.NativeMethodAccessorImpl.invoke (:-1)
    sun.reflect.DelegatingMethodAccessorImpl.invoke (:-1)
    java.lang.reflect.Method.invoke (:-1)
    clojure.lang.Reflector.invokeMatchingMethod (Reflector.java:93)
    clojure.lang.Reflector.invokeInstanceMethod (Reflector.java:28)
    cemerick.pomegranate.aether$resolve_dependencies_STAR_.invokeStatic (aether.clj:806)
    cemerick.pomegranate.aether$resolve_dependencies_STAR_.doInvoke (aether.clj:707)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    cemerick.pomegranate.aether$resolve_dependencies.invokeStatic (aether.clj:815)
    cemerick.pomegranate.aether$resolve_dependencies.doInvoke (aether.clj:809)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    cemerick.pomegranate$add_dependencies.invokeStatic (pomegranate.clj:83)
    cemerick.pomegranate$add_dependencies.doInvoke (pomegranate.clj:57)
    clojure.lang.RestFn.invoke (RestFn.java:457)
    leiningen.repl$client.invokeStatic (repl.clj:261)
    leiningen.repl$client.invoke (repl.clj:258)
    leiningen.repl$repl.invokeStatic (repl.clj:320)
    leiningen.repl$repl.doInvoke (repl.clj:267)
    clojure.lang.RestFn.invoke (RestFn.java:425)
    leiningen.repl$repl.invokeStatic (repl.clj:307)
    leiningen.repl$repl.invoke (repl.clj:267)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invokeStatic (core.clj:648)
    clojure.core$apply.invoke (core.clj:641)
    leiningen.core.main$partial_task$fn__4667.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:648)
    clojure.core$apply.invoke (core.clj:641)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:340)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__4734.invoke (main.clj:420)
    leiningen.core.main$_main.invokeStatic (main.clj:411)
    leiningen.core.main$_main.doInvoke (main.clj:408)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.lang.Var.invoke (Var.java:379)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.main$main_opt.invokeStatic (main.clj:314)
    clojure.main$main_opt.invoke (main.clj:310)
    clojure.main$main.invokeStatic (main.clj:421)
    clojure.main$main.doInvoke (main.clj:384)
    clojure.lang.RestFn.invoke (RestFn.java:436)
    clojure.lang.Var.invoke (Var.java:388)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact reply:reply:jar:0.3.7 from/to clojars (https://repo.clojars.org/): Not authorized by proxy , ReasonPhrase:Proxy Authentication Required.
 at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed (ArtifactTransportListener.java:52)
    org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:364)
    org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run (RunnableErrorForwarder.java:76)
    java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)
    java.lang.Thread.run (:-1)
Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Not authorized by proxy , ReasonPhrase:Proxy Authentication Required.
 at org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData (AbstractHttpClientWagon.java:1011)
    org.apache.maven.wagon.providers.http.AbstractHttpClientWagon.fillInputData (AbstractHttpClientWagon.java:962)
    org.apache.maven.wagon.StreamWagon.getInputStream (StreamWagon.java:126)
    org.apache.maven.wagon.StreamWagon.getIfNewer (StreamWagon.java:88)
    org.apache.maven.wagon.StreamWagon.get (StreamWagon.java:61)
    org.eclipse.aether.transport.wagon.WagonTransporter$GetTaskRunner.run (WagonTransporter.java:569)
    org.eclipse.aether.transport.wagon.WagonTransporter.execute (WagonTransporter.java:436)
    org.eclipse.aether.transport.wagon.WagonTransporter.get (WagonTransporter.java:413)
    org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:456)
    org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:359)
    org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run (RunnableErrorForwarder.java:76)
    java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)
    java.lang.Thread.run (:-1)

我不知道如何设置代理身份验证。

编辑: 我尝试使用-Dhttp.proxyHost=myHost -Dhttp.proxyPort=myPort -Dhttp.proxyUser=myUser -Dhttp.proxyPassword=myPw将代理参数添加到Java调用中,这些参数似乎未使用/没有作用。 相应的参数与例如视觉工作室代码。

2 个答案:

答案 0 :(得分:0)

设置http_proxyhttps_proxy环境变量应与lein repl一起使用。您在http_proxy前面加上了http吗?还是https_proxy和https?或尝试:

set http_proxy=proxy_ip:port
set http_proxy_user=user
set http_proxy_pass=password

答案 1 :(得分:0)

还将环境变量 https _proxy = proxy_ip:port设置为http_proxy