[英]How to setup Spring Boot CLI behind a proxy
I am currently attempting to leverage the Spring Boot CLI behind my corporate proxy.我目前正在尝试利用我的公司代理背后的 Spring Boot CLI。 I have tried a bunch of different ways of setting up the proxy for the Spring Boot CLI without success.我尝试了许多不同的方法来为 Spring Boot CLI 设置代理,但没有成功。
I have tried setting:我试过设置:
1) JAVA_OPTS environment variables for proxies 1) 代理的 JAVA_OPTS 环境变量
-Dhttp.proxyHost=proxyhostURL
-Dhttp.proxyPort=proxyPortNumber
-Dhttp.proxyUser=someUserName
-Dhttp.proxyPassword=somePassword
2) I have tried configuring just the http proxy environment variable 2)我试过只配置http代理环境变量
http_proxy
I have previously found the github bug that was closed years ago, but it doesn't seem to be relevant: https://github.com/spring-projects/spring-boot/issues/136我之前发现了几年前关闭的github bug,但似乎没有相关性: https : //github.com/spring-projects/spring-boot/issues/136
Thanks for any help!感谢您的帮助!
C:\Windows\system32>spring cloud eureka
Resolving dependencies..
███████╗██████╗ ██████╗ ██╗███╗ ██╗ ██████╗ ██████╗██╗ ██████╗ ██╗ ██╗██████╗
██╔════╝██╔══██╗██╔══██╗██║████╗ ██║██╔════╝ ██╔════╝██║ ██╔═══██╗██║ ██║██╔══██╗
███████╗██████╔╝██████╔╝██║██╔██╗ ██║██║ ███╗ ██║ ██║ ██║ ██║██║ ██║██║ ██║
╚════██║██╔═══╝ ██╔══██╗██║██║╚██╗██║██║ ██║ ██║ ██║ ██║ ██║██║ ██║██║ ██║
███████║██║ ██║ ██║██║██║ ╚████║╚██████╔╝ ╚██████╗███████╗╚██████╔╝╚██████╔╝██████╔╝
╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝╚══════╝ ╚═════╝ ╚═════╝ ╚═════╝
-- Spring Cloud Launcher --
2016-11-22 07:21:24.970 INFO 12076 --- [-cloud-launcher] o.s.boot.SpringApplication : Starting application on WKSP0006B796 with PID 12076 (D:\UPSData\DevRepo\spring-boot-cli-1.4.1.RELEASE-bin\spring-1.4.1.RELEASE\lib\spring-boot-cli-1.4.1.RELEASE.jar started by GSD4TYK in C:\Windows\system32)
2016-11-22 07:21:24.998 INFO 12076 --- [-cloud-launcher] o.s.boot.SpringApplication : No active profile set, falling back to default profiles: default
2016-11-22 07:21:26.097 INFO 12076 --- [-cloud-launcher] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@34f39db4: startup date [Tue Nov 22 07:21:26 EST 2016]; root of context hierarchy
2016-11-22 07:21:28.503 INFO 12076 --- [-cloud-launcher] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-11-22 07:21:30.727 INFO 12076 --- [-cloud-launcher] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-11-22 07:21:30.792 INFO 12076 --- [-cloud-launcher] o.s.boot.SpringApplication : Started application in 9.955 seconds (JVM running for 17.554)
Exception in thread "spring-cloud-launcher" java.lang.IllegalStateException: failed to resolve MavenResource: org.springframework.cloud.launcher:spring-cloud-launcher-eureka:jar:1.2.1.RELEASE
at org.springframework.cloud.deployer.resource.maven.MavenArtifactResolver.resolve(MavenArtifactResolver.java:276)
at org.springframework.cloud.deployer.resource.maven.MavenResource.getFile(MavenResource.java:169)
at org.springframework.cloud.deployer.spi.local.AbstractLocalDeployerSupport.buildExecutionCommand(AbstractLocalDeployerSupport.java:96)
at org.springframework.cloud.deployer.spi.local.AbstractLocalDeployerSupport.buildProcessBuilder(AbstractLocalDeployerSupport.java:141)
at org.springframework.cloud.deployer.spi.local.LocalAppDeployer.deploy(LocalAppDeployer.java:122)
at org.springframework.cloud.launcher.deployer.Deployer.deployInternal(Deployer.java:199)
at org.springframework.cloud.launcher.deployer.Deployer.deploy(Deployer.java:105)
at org.springframework.cloud.launcher.deployer.DeployerThread.launch(DeployerThread.java:116)
at org.springframework.cloud.launcher.deployer.DeployerThread.run(DeployerThread.java:61)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework.cloud.launcher:spring-cloud-launcher-eureka:jar:1.2.1.RELEASE from/to central (http://repo1.maven.org/maven2): Connect to repo1.maven.org:80 timed out
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifacts(DefaultRepositorySystem.java:302)
at org.springframework.cloud.deployer.resource.maven.MavenArtifactResolver.resolve(MavenArtifactResolver.java:273)
... 8 more
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework.cloud.launcher:spring-cloud-launcher-eureka:jar:1.2.1.RELEASE from/to central (http://repo1.maven.org/maven2): Connect to repo1.maven.org:80 timed out
at org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:43)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
... 11 more
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to repo1.maven.org:80 timed out
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:122)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:179)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:328)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:612)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:447)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:884)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:71)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:55)
at org.apache.http.impl.client.DecompressingHttpClient.execute(DecompressingHttpClient.java:164)
at org.eclipse.aether.transport.http.HttpTransporter.execute(HttpTransporter.java:287)
at org.eclipse.aether.transport.http.HttpTransporter.implGet(HttpTransporter.java:243)
at org.eclipse.aether.spi.connector.transport.AbstractTransporter.get(AbstractTransporter.java:59)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask(BasicRepositoryConnector.java:447)
at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:350)
... 16 more
2016-11-22 07:22:02.575 INFO 12076 --- [ Thread-1] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@34f39db4: startup date [Tue Nov 22 07:21:26 EST 2016]; root of context hierarchy
2016-11-22 07:22:02.591 INFO 12076 --- [ Thread-1] o.s.cloud.launcher.deployer.Deployer :
Shutting down ...
2016-11-22 07:22:02.591 INFO 12076 --- [ Thread-1] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
C:\Windows\system32>
Can you try maven proxy settings??可以试试maven代理设置吗?? I got this issue resolved after setting correct proxy and the correct corporate repository.在设置正确的代理和正确的公司存储库后,我解决了这个问题。
https://maven.apache.org/guides/mini/guide-proxies.html https://maven.apache.org/guides/mini/guide-proxies.html
In settings.xml, you can use:在 settings.xml 中,您可以使用:
<settings>
.
.
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
.
.
</settings>
https://maven.apache.org/guides/introduction/introduction-to-repositories.html https://maven.apache.org/guides/introduction/introduction-to-repositories.html
In pom.xml in project, you can use:在项目的 pom.xml 中,可以使用:
<project>
...
<repositories>
<repository>
<id>my-internal-site</id>
<url>http://myserver/repo</url>
</repository>
</repositories>
...
</project>
Please let me know if it doesnt work for you..如果它不适合你,请告诉我..
I had the same problem, go to your .m2 folder and open the settings.xml.我遇到了同样的问题,转到您的 .m2 文件夹并打开 settings.xml。 In the settings.xml-file delete the proxy dependencies, close the file and retry!在settings.xml文件中删除代理依赖,关闭文件重试!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.