Gradle Could not resolve org.springframework.boot:spring-boot-gradle-plugin:1.4.2.RELEASE (repo1.maven.org: Nome o servizio sconosciuto)
Solution 1
As the error tells you Nome o servizio sconosciuto
, repo1.maven.org
cannot be resolved via DNS. So you have some networking problem or you need to use a proxy server which you did not configure for Gradle. Ask your IT support as to why you cannot resolve the hostname.
Solution 2
This is might be a network issue. If not then please try below steps as it solved my issue.
As I was also facing the same problem, I tried to solve it by changing the dependencies.
This value gives me an error.
compile("org.springframework.boot:spring-boot-starter-ws")
This is what works
compile group: 'org.springframework.boot', name: 'spring-boot-starter-ws', version: '1.4.7.RELEASE'
Ref:https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-ws/1.1.8.RELEASE
Solution 3
I was getting spring-boot-starter dependency cant be resolved issue when i tried to run gradle first time on IntelliJ using gradle 3.5 using my laptop no proxy required.
The issue was missing:
apply plugin: 'org.springframework.boot'
from the build.gradle file. Once included it downloaded all the dependencies in a flash.
Solution 4
I experienced this issue as well but for a different reason than the currently accepted answer.
In my case, it was that the server housing the dependencies was not being passed the credentials properly.
The credentials were set in environment variables on a host container but not present in a child container making the call, so the connection worked fine on the host container, but failed with the Could not resolve...
errors listed in the question on the child container.
This was resolved by passing MAVEN_USERNAME
and MAVEN_PASSWORD
to gradle using -D options:
$ gradle -DMAVEN_USERNAME=foo -DMAVEN_PASSWORD=bar
sgargel
tcpdump lover. Linux addicted. CTRL+ALT+DEL specialist.
Updated on February 25, 2021Comments
-
sgargel about 3 years
I have a problem running a gradle build on Jenkins: Gradle version is 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' }
-
sgargel almost 7 yearsAre your sure? Because my build.gradle contains org.springframework.boot:spring-boot-gradle-plugin and the problem was solved fixing my internet connection (dns resolution).
-
Abhishek Tripathi over 6 yearsI read the entire error, but answered for one of the possible scenarios. If dependency is not downloading there can be lot of reasons. I couldn't comment on the above answer so I answered separately . Anyways thanks
-
sgargel over 4 yearsYou have always to watch last error messages (from up to bottom). In this case is ` repo1.maven.org: Nome o servizio sconosciuto` (or in english
Name or service not known error?
) that causes aCould not resolve dependecy
error.