gpt4 book ai didi

android - Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置

转载 作者:IT老高 更新时间:2023-10-28 22:24:50 58 4
gpt4 key购买 nike

我正在尝试使用 Cordova 为 Android 构建 Sencha Touch 应用程序。但是,在 gradle 构建开始后,我在尝试连接到 maven 存储库时遇到连接错误:

[INF] [shellscript] Running: C:\xxx\gradlew cdvBuildDebug -b C:\xxx\application\cordova\platforms\android\build.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。

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

最佳答案

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

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

这是取自 Chapter 19.3 of the User Guide 的示例.确保在文件中同时包含 HTTP 和 HTTPS 值。

您将把这个 gradle.properties 文件放在以下任一位置:

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

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

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

您还可以在 this post 中找到更多信息.

关于android - Gradle 无法通过企业代理连接到 maven repo - 需要通过 Sencha/Cordova 进行配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30219065/

58 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com