1

One of my coworkers recently deleted his ".gradle" directory. He was not able to build the project again, because of the following error:

Caused by: org.gradle.api.resources.ResourceException: Could not get resource 'https://repo.spring.io/plugins-release/com/github/node-gradle/gradle-node-plugin/2.2.1/gradle-node-plugin-2.2.1.pom'.
    at org.gradle.internal.resource.ResourceExceptions.failure(ResourceExceptions.java:74)
    at org.gradle.internal.resource.ResourceExceptions.getFailed(ResourceExceptions.java:57)
    at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadByCoords(DefaultExternalResourceArtifactResolver.java:138)
    at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.downloadStaticResource(DefaultExternalResourceArtifactResolver.java:97)
    at org.gradle.api.internal.artifacts.repositories.resolver.DefaultExternalResourceArtifactResolver.resolveArtifact(DefaultExternalResourceArtifactResolver.java:64)
    at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.parseMetaDataFromArtifact(AbstractRepositoryMetadataSource.java:69)
    at org.gradle.api.internal.artifacts.repositories.metadata.AbstractRepositoryMetadataSource.create(AbstractRepositoryMetadataSource.java:59)
    at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver.resolveStaticDependency(ExternalResourceResolver.java:244)
    at org.gradle.api.internal.artifacts.repositories.resolver.MavenResolver.doResolveComponentMetaData(MavenResolver.java:127)
    at org.gradle.api.internal.artifacts.repositories.resolver.ExternalResourceResolver$RemoteRepositoryAccess.resolveComponentMetaData(ExternalResourceResolver.java:445)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.CachingModuleComponentRepository$ResolveAndCacheRepositoryAccess.resolveComponentMetaData(CachingModuleComponentRepository.java:378)
    at org.gradle.api.internal.artifacts.ivyservice.ivyresolve.ErrorHandlingModuleComponentRepository$ErrorHandlingModuleComponentRepositoryAccess.resolveComponentMetaData(ErrorHandlingModuleComponentRepository.java:138)

And I tried to access the URL 'https://repo.spring.io/plugins-release/com/github/node-gradle/gradle-node-plugin/2.2.1/gradle-node-plugin-2.2.1.pom' directly on browser, and it's now asking user and password.

Did somewone known what's happening? Did this repo was moved to another host?

Thanks in advance.

edit: My gradle repositories:

repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven { url "https://repo.spring.io/plugins-release" }
        maven { url "https://plugins.gradle.org/m2/" }
        
    }
Hugo
  • 11
  • 2
  • What is inside `repo{ }` in your build.gradle? – Chayne P. S. Sep 17 '20 at 18:59
  • We are using the following repositories: ``` repositories { mavenLocal() mavenCentral() jcenter() maven { url "https://repo.spring.io/plugins-release" } maven { url "https://plugins.gradle.org/m2/" } } ``` – Hugo Sep 17 '20 at 19:26
  • Is the url not having a "https://" prefix ? – Gaurav Sep 17 '20 at 20:11
  • The formatting of the comment removed the prefix. I'll update the question... – Hugo Sep 17 '20 at 20:27
  • Check this url if it helps.. https ://plugins.gradle.org/plugin/com.github.node-gradle.node/2.2.1 – Gaurav Sep 17 '20 at 21:09
  • If you are using an IDE, try clearing the cache and restarting it. Also, Rearrange the order of your repository swap mavenLocal() with maven { url "https://plugins.gradle.org/m2/" } and re-run the clean build ... – Gaurav Sep 18 '20 at 03:44

2 Answers2

0

Looks like you are downloading from a jfrog repository and are missing the gradle.properties file .. The .gradle folder contains a file called "gradle.properties" which contains the credentials (usually encrypted from the above repo in case of employer controlled repo)to access the jars/poms.

The steps to generate and download : 1.Go to https://repo.spring.io/ and login if you have workplace credentials for accessing the repo. 2.search for "plugins-release" is the "set-me-up" scroller. 3. select Gradle in "tools" drop-down and Generate gradle.properties. 4.download this "gradle.properties" and put it in .gradle folder under the username directory.

Gaurav
  • 76
  • 4
  • I don't have an account. We aways used this repo, and we ever thought it was public... Do you know if it changed recently? Or if there is some way to create user for this repo? thank you – Hugo Sep 17 '20 at 19:25
  • They have made everything https in recent times.. so update all the URLs of repo.spring.io with https in your build.gradle – Gaurav Sep 17 '20 at 20:00
0

switch the order of the last 2 lines under repositories. It becomes:

repositories {
        mavenLocal()
        mavenCentral()
        jcenter()
        maven { url "https://plugins.gradle.org/m2/" }
        maven { url "https://repo.spring.io/plugins-release" }
    }

This way Gradle will resolve gradle-node-plugin from the official Gradle plugin portal (https://plugins.gradle.org/m2/), instead of from Spring's Artifactory (which caches 3rd party artifacts, but you don't really want to fetch non Spring plugins from it).

Also see this answer: https://stackoverflow.com/a/22170251/2591231

PS:
I am assuming that in your build.gradle you apply the plugin "com.moowork.node" as shown here under "Using legacy plugin application", and that the repositories block is inside a buildscript block. Otherwise, your repositories block has no effect on plugin resolution.

Doron Gold
  • 3,664
  • 4
  • 32
  • 44