Describe the bug Cannot build \spring-security\samples\boot\saml2login project from source.

To Reproduce

  1. Clone repository (https://github.com/spring-projects/spring-security/)
  2. Checkout 5.4.x
  3. cd to \spring-security\samples\boot\saml2login folder
  4. run gradle compileJava

Observe the error: D:\SAML\spring-security\samples\boot\saml2login>gradle tasks

FAILURE: Build failed with an exception.

  • What went wrong: A problem occurred configuring root project 'spring-security'.

    Could not resolve all artifacts for configuration ':classpath'. Could not resolve com.fasterxml.jackson.core:jackson-databind:2.11.4. Required by: project : > org.springframework.boot:spring-boot-gradle-plugin:2.4.2 > org.springframework.boot:spring-boot-buildpack-platform:2.4.2 > Could not resolve com.fasterxml.jackson.core:jackson-databind:2.11.4. > Could not get resource 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/core/jackson-databind/2.11.4/jackson-databind-2.11.4.pom'. > Could not HEAD 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/core/jackson-databind/2.11.4/jackson-databind-2.11.4.pom'. Received status code 401 from server: Unauthorized > Could not resolve com.fasterxml.jackson.core:jackson-databind:2.11.4. > Could not parse POM https://plugins.gradle.org/m2/com/fasterxml/jackson/core/jackson-databind/2.11.4/jackson-databind-2.11.4.pom > Could not resolve com.fasterxml.jackson:jackson-base:2.11.4. > Could not resolve com.fasterxml.jackson:jackson-base:2.11.4. > Could not get resource 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-base/2.11.4/jackson-base-2.11.4.pom'. > Could not HEAD 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-base/2.11.4/jackson-base-2.11.4.pom'. Received status code 401 from server: Unauthorized > Could not resolve com.fasterxml.jackson:jackson-base:2.11.4. > Could not parse POM https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-base/2.11.4/jackson-base-2.11.4.pom > Could not resolve com.fasterxml.jackson:jackson-bom:2.11.4. > Could not resolve com.fasterxml.jackson:jackson-bom:2.11.4. > Could not get resource 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-bom/2.11.4/jackson-bom-2.11.4.pom'. > Could not HEAD 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-bom/2.11.4/jackson-bom-2.11.4.pom'. Received status code 401 from server: Unauthorized > Could not resolve com.fasterxml.jackson:jackson-bom:2.11.4. > Could not parse POM https://plugins.gradle.org/m2/com/fasterxml/jackson/jackson-bom/2.11.4/jackson-bom-2.11.4.pom > Could not download jackson-parent-2.11.pom (com.fasterxml.jackson:jackson-parent:2.11) > Could not get resource 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-parent/2.11/jackson-parent-2.11.pom'. > Could not HEAD 'https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-parent/2.11/jackson-parent-2.11.pom'. Received status code 401 from server: Unauthorized

Expected behavior Build must succed.

Sample

A link to a GitHub repository with a minimal, reproducible sample.

Reports that include a sample will take priority over reports that do not. At times, we may require a sample, so it is good to try and include a sample up front.

Comment From: eleftherias

Thanks for reaching out @ibaskine.

I haven't been able to reproduce this. What does you environment looks like (OS, Java version)?

Could you also confirm that you have pulled the latest changes from the 5.4.x branch?

Comment From: homaxto

I see this as well. I have checked out both master and 5.4.x and see the error when building with gradle and when IntelliJ is pulling dependencies.

Trying to access the following from a browser also yields the same result - login is required: https://repo.spring.io/plugins-snapshot/com/fasterxml/jackson/jackson-base/2.11.4/jackson-base-2.11.4.pom

Comment From: eleftherias

Thanks @homaxto. It makes sense that accessing repo.spring.io directly requires authentication because of the permission changes that happened earlier this year.

It puzzles me why the project is attempting to fetch the Jackson dependency from repo.spring.io rather than maven central.

I'm still not able to reproduce this. Could you share some information about your environment and confirm that you have pulled the latest changes from the 5.4.x branch?

Comment From: homaxto

@eleftherias, just let me know what info you need.

I am running the tip of 5.4.x which I checked out yesterday. I believe I was able to build master some time yesteryear, though I have only used it as a supplement to the documentation.

If I remove the https://repo.spring.io/plugins-snapshot repository a lot of dependencies are downloaded, and then it ends with

> Could not resolve all artifacts for configuration ':classpath'.
   > Could not find io.spring.gradle:spring-build-conventions:0.0.37.
     Searched in the following locations:
       - https://plugins.gradle.org/m2/io/spring/gradle/spring-build-conventions/0.0.37/spring-build-conventions-0.0.37.pom
     If the artifact you are trying to retrieve can be found in the repository but without metadata in 'Maven POM' format, you need to adjust the 'metadataSources { ... }' of the repository declaration.
     Required by:
         project :

Comment From: eleftherias

@homaxto What is your OS and Java version? Could you also share the exact command that you are running?

Comment From: homaxto

I run Mac, Java 11 and ./gradlew build

Comment From: michaldo

Please do not waste time asking for Java and OS version.

Simply following procedure "Build from source" fails due repository restriction, as described for example on https://stackoverflow.com/questions/64839144/got-an-error-when-building-spring-security-from-source

Please fix the procedure to allow contribute to Spring Security like to other opensource projects

Comment From: jzheaux

The SAML 2.0 login sample has been moved to the Spring Security Samples project, which uses neither the plugins-snapshot repo nor Spring Build Conventions.

If you are still having build issues with this sample, please report it in that project, and we'd be happy to help out.

Comment From: poo0054

I'm having this problem too, I'm using Release 5.4.11 Josh Cummings 2022/5/17 4:29 tag build source code. Then it reports an error

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'spring-security'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve io.spring.gradle:spring-build-conventions:0.0.38.
     Required by:
         project :
      > Could not resolve io.spring.gradle:spring-build-conventions:0.0.38.
         > Could not get resource 'https://repo.spring.io/plugins-snapshot/io/spring/gradle/spring-build-conventions/0.0.38/spring-build-conventions-0.0.38.pom'.
            > Could not GET 'https://repo.spring.io/plugins-snapshot/io/spring/gradle/spring-build-conventions/0.0.38/spring-build-conventions-0.0.38.pom'. Received status code 401 from server: 

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Comment From: poo0054

I tried many versions and found that they all require a package that cannot resolve io.spring.gradle:spring-build-conventions:0.0.38. Then the website https://repo.spring.io/plugins-snapshot/io/spring/gradle/spring-build-conventions/0.0.38/spring-build-conventions-0.0.38.pom requires password. I'm confused.