简体   繁体   English

gradle 中 maven 回购的连接超时错误

[英]Connection timeout error for maven repo in gradle

I am getting below error when Jenkins pipeline is run:运行 Jenkins 管道时出现以下错误:

  Welcome to Gradle 7.0!
  Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'Auth-mapper'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.7.7.
  Required by:
      project :
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:2.7.7.
      > Could not get resource 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.7.7/spring-boot-gradle-plugin-2.7.7.pom'.
         > Could not GET 'https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/2.7.7/spring-boot-gradle-plugin-2.7.7.pom'.
            > Connect to repo.maven.apache.org:443 [repo.maven.apache.org/146.75.32.215] failed: connect timed out
> Could not resolve io.spring.gradle:dependency-management-plugin:1.1.0.
  Required by:
      project :
   > Could not resolve io.spring.gradle:dependency-management-plugin:1.1.0.

my build.gradle file is having these entries:我的 build.gradle 文件包含以下条目:

 buildscript {
   repositories {
       mavenCentral()
       maven {
       url "https://plugins.gradle.org/m2/"
      }
   }
   dependencies {
   classpath "org.springframework.boot:spring-boot-gradle-plugin:2.7.7"
   classpath "io.spring.gradle:dependency-management-plugin:1.1.0"
   classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0"  
 }
apply plugin: "org.springframework.boot"
apply plugin: "io.spring.dependency-management"
apply plugin: "org.sonarqube"

When I run this application in local then its working fine but when I try deploying it to openshift via Jenkins then in the build step its failing due to the above issue.当我在本地运行这个应用程序时它工作正常但是当我尝试通过 Jenkins 将它部署到 openshift 然后在构建步骤中它由于上述问题而失败。

Below configuration in gradle.properties based on above comments worked for me...基于以上评论的 gradle.properties 中的以下配置对我有用...

systemProp.https.proxyHost
systemProp.https.proxyPort
systemProp.http.nonProxyHosts

The above properties values needs to be set based on company specific configuration.以上属性值需要根据公司特定配置进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM