8

I'm looking at spring-boot at the moment, but cannot access the repo.spring.io maven repository in builds.

I've created the initial Gradle build file , but receive a 401 (Unauthorised) response when I try to run the build for the first time. I've tried pulling down the POM/JARs manually (to manually deploy to my local repo), but again receive 401.

If I browse to the relevant folder and click on the JAR (POMS seem to be OK), I receive a 401 error here too (response is: The server http://repo.spring.io:80 requires a username and password. The server says: Artifactory Realm)

Can someone direct me to a repo I can actually pull these files from? Alternatively, can someone direct me to where I can get credentials for this repo?

Thanks

GKelly
  • 3,835
  • 4
  • 38
  • 45

5 Answers5

6

repo.spring.io lazily caches the contents of Maven Central. You don't say which dependency it is that's causing a problem, but I believe the problem that you're seeing is that you're attempting to access an artifact that has yet to be cached. This will result in a 401 response.

Trying adding mavenCentral() to the configured repositories in build.gradle. For example:

repositories {
    mavenCentral()
    maven { url "https://repo.spring.io/milestone" }
}
Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
  • 1
    The link does not show any details on why we are getting 401... I am getting 401 and this didn't help – Dimitri Kopriwa Oct 15 '20 at 13:03
  • I've removed the link as it was broken – the page it pointed to has been removed from the Spring Framework wiki. In addition to not trying to use repo.spring.io as a lazy proxy for Maven central, you should also check that you're accessing it over `https` rather than plain `http`. – Andy Wilkinson Oct 15 '20 at 15:02
  • 3
    I ended up using `jcenter()` in addition of `mavenCentral()`and that fixed the problem – Dimitri Kopriwa Oct 15 '20 at 18:00
5

repo.spring.io is no longer serving through plain http. Check your gradle (pom.xml, etc) file for http://repo.spring.io and change it to https://repo.spring.io

The relevant maven error message is similar to this:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.8.2:site (default-site) on project tidy-up: SiteToolException: The site descriptor cannot be resolved from the repository: ArtifactResolutionException: Unable to locate site descriptor: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:xml:site_en:2.2.4.RELEASE from/to springplugins (http://repo.spring.io/plugins-release/): Access denied to: http://repo.spring.io/plugins-release/org/springframework/boot/spring-boot-starter-parent/2.2.4.RELEASE/spring-boot-starter-parent-2.2.4.RELEASE-site_en.xml , ReasonPhrase:Forbidden.
Árpád Magosányi
  • 1,394
  • 2
  • 19
  • 35
  • 1
    Geez, you'd think they'd do a redirect to https rather than break a million builds – Sparm Feb 01 '21 at 22:39
  • @Sparm only an assumption, but I think that’s because it wouldn’t protect your builds against MITM attacks, as HSTS only works if the client caches it, which most likely won’t be the case in CI pipelines. Best is thus to make sure that people manually update the URL. – Didier L Dec 20 '21 at 12:54
2

repo.spring.io is no longer serving through plain http.

1- Check your pom.xml file for http://repo.spring.io/plugins-release/

2- and change it to https://repo.spring.io/plugins-release/

like below

<repositories>
  <repository>
    <id>spring-repo</id>
    <url>https://repo.spring.io/plugins-release/</url>
  </repository>
</repositories>
Schwertfisch
  • 133
  • 3
  • 16
1

This works for me when i was trying to do practice on spring boot.

  1. Go to .m2 Folder

  2. Create settings.xml

  3. Copy the code below

    CODE IN THE FIRST COMMENT

AMiALiF
  • 19
  • 4
  • centralhttps central Maven central https http://insecure.repo1.maven.org/maven2/ – AMiALiF Aug 27 '20 at 03:53
  • When posting answers is a good practice to explain why this solution should be adopted, cut & paste solutions are usable only in a specific context, while explanations can be reused in many situations :-) – funder7 Nov 18 '20 at 11:37
0

There was a change in the visibility of artefacts in repo.spring.io/snapshot.

Please add the following argument when launching Spring Cloud Data Flow server.

--maven.remote-repositories.springRepo.url=https://repo.spring.io/libs-snapshot

Or an environmental variable: MAVEN_REMOTE_REPOSITORIES_SPRING_REPO_URL=https://repo.spring.io/libs-snapshot

It may be better if you are using release versions to use:

--maven.remote-repositories.central.url=https://repo.maven.apache.org/maven2

Or environmental variable:

MAVEN_REMOTE_REPOSITORIES_CENTRAL_URL=https://repo.maven.apache.org/maven2

sartysam
  • 23
  • 5