how to setup a libGDX project via proxy

2019-04-10 08:16发布

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: I have already tried to edit the settings under Control Panel->Java->Network Settings but to no avail.

4条回答
混吃等死
2楼-- · 2019-04-10 08:50

From Gradle's manual: 12.3. Accessing the web via a proxy

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

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

This works for me, behind a HTTP Proxy. Change it with your proxy settings.

Later, import your projects into Eclipse. And make sure your Eclipse Network Proxy is OK too.

查看更多
该账号已被封号
3楼-- · 2019-04-10 08:52

If you run gdx-setup.jar from the command line, you should be able to tell the JVM to use the proxy settings using http.proxyHost and http.proxyPort.

See: How do I set the proxy to be used by the JVM for more information.

The command line would be something similar to:

java -Dhttp.proxyHost=10.0.0.1 -Dhttp.proxyPort=8080 -jar gdx-setup.jar
查看更多
Lonely孤独者°
4楼-- · 2019-04-10 08:53

I was able to workaround this problem using Eclipse with proxy configured in

Window -> Preferences -> Network Connections

I think it should be possible also in other IDEs or even Gradle (if you install it manually), provided that they have properly configured proxy.
This is because the Project Creator creates the whole directory structure, classes, etc., it fails later, when trying to download Gradle.

What I did after it failed is I went to Eclipse, I chose 'Import as Gradle project' and then clicked the Build Project button.
This downloaded Gradle and all the needed jars.

查看更多
趁早两清
5楼-- · 2019-04-10 09:00

Here is a working solution:

http://badlogicgames.com/forum/viewtopic.php?t=16414&p=70348

For windows 7, gradle.properties is under C:\Users\USER_NAME.gradle\ (or create one if not exist)

Steps: 1. prepare gradle.properties file with following content

org.gradle.daemon=true
org.gradle.jvmargs=-Xms128m -Xmx1500m
org.gradle.configureondemand=true
systemProp.http.proxyHost=
systemProp.http.proxyPort=8080
systemProp.https.proxyHost=
systemProp.https.proxyPort=8080
  1. run the jar through the same proxy

    java -Dhttp.proxyHost=**** -Dhttp.proxyPort=** -Dhttp.proxyUser=******** -Dhttp.proxyPassword=**** -jar gdx-setup.jar

查看更多
登录 后发表回答