'Sping security OpenSAML 4.1.1 artifacts not found

I have a maven multi module project where I'm using spring boot 2.6.4 and spring security in a saml2 scenario.

As far as I know spring uses opensaml and more exactly opensaml 4.1.1

I added this dependencies to the pom of my saml maven module:

<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-core</artifactId>
  <version>4.1.1</version>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-saml-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-saml-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-security-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-security-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-profile-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-messaging-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-messaging-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xmlsec-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xmlsec-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-soap-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-soap-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xacml-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xacml-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xacml-saml-api</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.opensaml</groupId>
  <artifactId>opensaml-xacml-saml-impl</artifactId>
  <version>4.1.1</version>
  <exclusions>
    <exclusion>
      <artifactId>*</artifactId>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>

In order to resolve the above dependency in my parent pom I added the following repositories:

<repositories>
    <repository>
        <id>shibboleth_repository</id>
        <name>Shibboleth Maven Repository</name>
        <url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
    </repository>
    <repository>
        <id>shibboleth_repository_2</id>
        <name>Shibboleth Maven Repository (https://mvnrepository.com/artifact/org.opensaml/opensaml-core/4.1.1)</name>
        <url>https://build.shibboleth.net/maven/releases/</url>
    </repository>
    <repository>
        <id>mule_soft</id>
        <name>Mule Soft Maven Repository</name>
        <url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
    </repository>       
</repositories>

So far so good. When I execute maven clean install command mvn clean install all works good and the build ends correctly

When I try to build the maven site (mvn clean install site:site site:stage -DskipTests) I got the following error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.10.0:site (default-cli) on project sael.module: Execution default-cli of goal org.apache.maven.plugins:maven-site-plugin:3.10.0:site failed: org.apache.maven.reporting.MavenReportException: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: org.opensaml:opensaml-core:jar:4.1.1, org.opensaml:opensaml-saml-api:jar:4.1.1, org.opensaml:opensaml-saml-impl:jar:4.1.1, org.opensaml:opensaml-security-api:jar:4.1.1, org.opensaml:opensaml-security-impl:jar:4.1.1, org.opensaml:opensaml-profile-api:jar:4.1.1, org.opensaml:opensaml-messaging-api:jar:4.1.1, org.opensaml:opensaml-messaging-impl:jar:4.1.1, org.opensaml:opensaml-xmlsec-api:jar:4.1.1, org.opensaml:opensaml-xmlsec-impl:jar:4.1.1, org.opensaml:opensaml-soap-api:jar:4.1.1, org.opensaml:opensaml-soap-impl:jar:4.1.1, org.opensaml:opensaml-xacml-api:jar:4.1.1, org.opensaml:opensaml-xacml-impl:jar:4.1.1, org.opensaml:opensaml-xacml-saml-api:jar:4.1.1, org.opensaml:opensaml-xacml-saml-impl:jar:4.1.1: Could not find artifact org.opensaml:opensaml-core:jar:4.1.1 in central (https://repo.maven.apache.org/maven2) -> [Help 1]

Can anyone explain to me why this error? How can I fix it?

If libraries are not found they should always be not found... not only during the site generation.

Thank you

Angelo



Solution 1:[1]

I know this is 2 months old, but I ran into the same thing just today and thought I would share what worked for me. I worked on a project in January that used OpenSaml 4.1.1, and I started a new one today and brought in the similar dependencies in my pom which also said the artifacts could not be found. In addition to adding the shibboleth repositories in the repositories section as the original poster did, I also added the same repositories as pluginRepositories and that allowed the mvn clean install site command to process successfully. The POM snippet looks like:

 <project>
    <!-- other pom elements.... -->    
    <repositories>
        <repository>
            <id>shibboleth_repository</id>
            <name>Shibboleth Maven Repository</name>
            <url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
        </repository>
        <repository>
            <id>shibboleth_repository_2</id>
            <name>Shibboleth Maven Repository (https://mvnrepository.com/artifact/org.opensaml/opensaml-core/4.1.1)</name>
            <url>https://build.shibboleth.net/maven/releases/</url>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>shibboleth_repository</id>
            <name>Shibboleth Maven Repository</name>
            <url>https://build.shibboleth.net/nexus/content/repositories/releases/</url>
        </pluginRepository>
        <pluginRepository>
            <id>shibboleth_repository_2</id>
            <name>Shibboleth Maven Repository (https://mvnrepository.com/artifact/org.opensaml/opensaml-core/4.1.1)</name>
            <url>https://build.shibboleth.net/maven/releases/</url>
        </pluginRepository>
    </pluginRepositories>
</project>

Hope that helps anyone else that runs into it!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1