Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置 [英] Gradle can't connect to maven repo through corporate proxy - need to configure through Sencha/Cordova

查看:13
本文介绍了Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Cordova 为 android 构建 Sencha Touch 应用程序.但是,在 gradle 构建开始后,尝试连接到 Maven 存储库时出现连接错误:

I'm trying to build a Sencha Touch app for android using Cordova. However, after the gradle build kicks off I get a connection error when trying to connect to the maven repo:

[INF] [shellscript] Running: C:xxxgradlew cdvBuildDebug -b C:xxxapplicationcordovaplatformsandroiduild.gradle -Dorg.gradle.daemon=true
[INF] [shellscript]
[INF] [shellscript] FAILURE: Build failed with an exception.
[INF] [shellscript]
[INF] [shellscript] * What went wrong:
[INF] [shellscript] A problem occurred configuring root project '''android'''.
[INF] [shellscript] > Could not resolve all dependencies for configuration ''':classpath'''.
[INF] [shellscript]    > Could not resolve com.android.tools.build:gradle:1.0.0+.
[INF] [shellscript]      Required by:
[INF] [shellscript]          :android:unspecified
[INF] [shellscript]       > Failed to list versions for com.android.tools.build:gradle.
[INF] [shellscript]          > Unable to load Maven meta-data from https://repo1
.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
[INF] [shellscript]             > Could not GET '''https://repo1.maven.org/maven
2/com/android/tools/build/gradle/maven-metadata.xml'''.
[INF] [shellscript]                > Connection to https://repo1.maven.org refused

我想这与我必须在办公室中连接的公司代理有关 - 但是我不确定如何配置 Gradle 以通过此代理进行连接,因为它是由 Cordova 执行的,而 Cordova 本身也在执行通过 Sencha Cmd.

I would imagine this is related to the corporate proxy I have to connect through in my office - however I'm not sure how to configure Gradle to connect via this proxy since it is being executed by Cordova, which is itself being executed by Sencha Cmd.

有没有办法用 Sencha 配置代理?

Is there a way to configure a proxy with Sencha?

推荐答案

您需要配置 Gradlew 以使用代理服务器.这是通过创建具有以下内容的 gradle.properties 文件来完成的:

You'll need to configure Gradlew to use a proxy server. This is done by creating a gradle.properties file with the following contents:

systemProp.http.proxyHost=www.somehost.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxyrepos.com|localhost  

systemProp.https.proxyHost=www.somehost.org
systemProp.https.proxyPort=8080
systemProp.https.proxyUser=userid
systemProp.https.proxyPassword=password
systemProp.https.nonProxyHosts=*.nonproxyrepos.com|localhost

这是取自用户指南第 19.3 章的示例.确保您的文件中同时包含 HTTP 和 HTTPS 值.

This is an example taken from Chapter 19.3 of the User Guide. Make sure you include both the HTTP and HTTPS values in your file.

您需要将此 gradle.properties 文件放在以下任一位置:

You'll place this gradle.properties file in either of these locations:

  1. 在您的移动项目的cordova/platform/android"文件夹中

  1. 在您的 Gradle 主文件夹中.对于 Windows,这可能是 %USERPROFILE%.gradle(例如:C:Usersusername.gradle).

我建议将它放在 Gradle home 中,这样其他项目就可以使用它,而您不必担心将其置于源代码控制之下.

I would recommend putting it in Gradle home so that other projects pick it up and you don't have to worry about putting it under source control.

您还可以在这篇文章中找到更多信息.

You can also find more info in this post.

这篇关于Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆