java - Gradle 无法解析 org.springframework.boot :spring-boot-gradle-plugin:1. 4.2.RELEASE (repo1.maven.org: Nome o servizio sconosciuto)

标签 java spring jenkins gradle

我在 Jenkins 上运行 gradle 构建时遇到问题: Gradle 版本是 https://services.gradle.org/distributions/gradle-2.14.1-bin.zip

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'myApp'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE.
     Required by:
         :myApp:unspecified
      > Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE.
         > Could not get resource 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.2.RELEASE/spring-boot-gradle-plugin-1.4.2.RELEASE.pom'.
            > Could not HEAD 'https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.2.RELEASE/spring-boot-gradle-plugin-1.4.2.RELEASE.pom'.
               > repo1.maven.org: Nome o servizio sconosciuto

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

This is my build.gradle file:

buildscript {
    ext {
        springBootVersion = '1.4.2.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse-wtp'
apply plugin: 'org.springframework.boot'
apply plugin: 'war'


war {
    baseName = 'myApp'
    version = '1.0.5'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    mavenCentral()
}

configurations {
    providedRuntime
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-thymeleaf')
    providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
    compile('org.springframework.boot:spring-boot-starter-security')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('com.fasterxml.jackson.core:jackson-core:2.7.3')
    compile("org.springframework:spring-jdbc")
    compile('com.fasterxml.jackson.core:jackson-databind:2.7.3')
    compile('com.fasterxml.jackson.core:jackson-annotations:2.7.3')
    compile files('src/main/resources/static/lib/ojdbc7.jar')
    // https://mvnrepository.com/artifact/org.json/json
    compile group: 'org.json', name: 'json', version: '20080701'

}

最佳答案

正如错误告诉你 Nome o servizio sconosciutorepo1.maven.org 无法通过 DNS 解析。所以你有一些网络问题,或者你需要使用你没有为 Gradle 配置的代理服务器。向您的 IT 支持人员询问您无法解析主机名的原因。

关于java - Gradle 无法解析 org.springframework.boot :spring-boot-gradle-plugin:1. 4.2.RELEASE (repo1.maven.org: Nome o servizio sconosciuto),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41979802/

相关文章:

ruby-on-rails - 如何让承包商正确访问我的工作流程?

docker - 在 Jenkinsfile 中运行图像时如何传递 docker 容器参数

java - 为什么会发生 "Could not locate ordinal parameter [0], expecting one of []"?

java - 如何解决java中包不存在的错误

java - hibernate/ Spring : Not-null property references a null or transient value

java - MySQL 中的参数索引超出范围(1 > 参数个数,即 0)

linux - 使用 SSH 从 jenkins 运行 SSH 脚本命令

java - 使用 AngularJS、Spring 和 Hibernate 保存房间预订

java - Android 使用哪种协议(protocol)将其屏幕转换到 Chrome Cast 等其他设备

java - Spring XML 处理程序映射