我正在使用 libgdx 项目创建器 (gdx-setup.jar) 来设置一个新项目.但是,我在我的 Windows 机器上使用代理连接来访问 Internet,并且 gdx-setup.jar 无法检测到设置,因此我无法下载所需的 jar 文件并生成任何项目.我如何以及在哪里更改 java 代理设置,以便能够实现这一点?
I am using the libgdx project creator (gdx-setup.jar) to setup a new project. However, I am using a proxy connection on my Windows machine to access the internet and the gdx-setup.jar isn't able to detect the settings, thus I cannot download the required jar files and generate any project. How and where do I change the java proxy settings so that I am able to achieve this?
PS:我已经尝试在控制面板->Java->网络设置下编辑设置,但无济于事.
PS: I have already tried to edit the settings under Control Panel->Java->Network Settings but to no avail.
来自 Gradle 的手册:12.3.通过代理访问网络
From Gradle's manual: 12.3. Accessing the web via a proxy
您可能需要创建一个 $HOME/.gradle/gradle.properties 文件.例如:
You may need to create a $HOME/.gradle/gradle.properties file. For example:
systemProp.http.proxyHost=10.0.0.1
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=
systemProp.http.proxyPassword=
systemProp.http.nonProxyHosts=*.some.domain.com|localhost
重要提示:HTTPS 有单独的设置.
IMPORTANT: There are separate settings for HTTPS.
systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost
然后,像这样运行设置:
Then, just run setup like this:
java -Dhttp.proxyHost=10.0.0.1 -Dhttp.proxyPort=8080 -Dhttps.proxyHost=10.0.0.1 -Dhttps.proxyPort=8080 -jar gdx-setup.jar
这对我有用,在 HTTP 代理后面.使用您的代理设置进行更改.
This works for me, behind a HTTP Proxy. Change it with your proxy settings.
稍后,将您的项目导入 Eclipse.并确保您的 Eclipse 网络代理也正常.
Later, import your projects into Eclipse. And make sure your Eclipse Network Proxy is OK too.
这篇关于如何通过代理设置 libGDX 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!