java 代理背后的 Nexus

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26802197/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-02 10:37:53  来源:igfitidea点击:

Nexus behind a proxy

javamavenproxynexus

提问by zootropo

I'm trying to install Nexus (the repository manager for Maven) in a machine behind a proxy. When I execute the server it tries to connect to the default repositories (https://repository.apache.org:443, https://repo1.maven.org:443and https://nexus.codehaus.org:443) but it fails with a "network is unreachable" message (because of the proxy, I assume).

我正在尝试在代理后面的机器上安装 Nexus(Maven 的存储库管理器)。当我执行服务器时,它会尝试连接到默认存储库(https://repository.apache.org:443https://repo1.maven.org:443https://nexus.codehaus.org:443)但它因“网络无法访问”消息而失败(我假设是因为代理)。

I tried adding additional JVM parameters to the jsw/config/wrapper.conf file to configure the proxy but it doesn't seem to work:

我尝试向 jsw/config/wrapper.conf 文件添加额外的 JVM 参数来配置代理,但它似乎不起作用:

wrapper.java.additional.4=-Dhttp.proxyHost=10.104.1.7
wrapper.java.additional.5=-Dhttp.proxyPort=8080
wrapper.java.additional.6=-Dhttps.proxyHost=10.104.1.7
wrapper.java.additional.7=-Dhttps.proxyPort=8080

Anyone know how I can get this to work?

有谁知道我怎样才能让它发挥作用?

回答by David Levesque

There is a section in the Nexus Admin UI to configure proxy settings. It is located under Administration --> Server. See section 6.1.5 of the Nexus Documentation.

Nexus Admin UI 中有一个部分用于配置代理设置。它位于管理 --> 服务器下。请参阅Nexus 文档的第 6.1.5 节。

回答by Harshal Vaidya

The answer above works if the Nexus application is already running and you are then trying to configure the proxy. I had to install Nexus on a machine without internet connection. During activation of license it tries to contact licensing.sonatype.com for which you will either need a direct internet connection or will need to ssh port forward it through another open to internet box. This little nuance gave me a hard time.

如果 Nexus 应用程序已经在运行并且您正在尝试配置代理,则上述答案有效。我不得不在没有互联网连接的机器上安装 Nexus。在激活许可证期间,它会尝试联系 license.sonatype.com,为此您需要直接连接 Internet 或需要通过另一个打开 Internet 的框将其 ssh 端口转发。这种细微的差别让我很难受。

回答by vmartin

>nexus.exe /run -Dhttps.proxyHost=10.104.1.7 -Dhttps.proxyPort=8080