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

新手上路,请多包涵

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

失败:构建失败,出现异常。

* 什么地方出了错:
配置根项目“myApp”时出现问题。
> 无法解析配置“:classpath”的所有依赖项。
   > 无法解析 org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE。
     要求:
         :我的应用程序:未指定
      > 无法解析 org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE。
         > 无法获取资源“https://repo1.maven.org/maven2/org/springframework/boot/spring-boot-gradle-plugin/1.4.2.RELEASE/spring-boot-gradle-plugin-1.4.2。发布.pom'。
            > 无法 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

* 尝试:
使用 --stacktrace 选项运行以获取堆栈跟踪。使用 --info 或 --debug 选项运行以获得更多日志输出。

这是我的 build.gradle 文件:

 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'

}

原文由 sgargel 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 997
2 个回答

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

原文由 Vampire 发布,翻译遵循 CC BY-SA 3.0 许可协议

这可能是网络问题。如果没有,请尝试以下步骤,因为它解决了我的问题。

由于我也面临同样的问题,我尝试通过更改依赖项来解决它。

这个值给我一个错误。

 compile("org.springframework.boot:spring-boot-starter-ws")

这是有效的

compile group: 'org.springframework.boot', name: 'spring-boot-starter-ws', version: '1.4.7.RELEASE'

参考: https ://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-ws/1.1.8.RELEASE

原文由 rahulnikhare 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题