maven 未找到Sping安全OpenSAML 4.1.1工件

h7appiyu  于 2022-12-11  发布在  Maven
关注(0)|答案(2)|浏览(476)

我有一个maven多模块项目,我在saml2场景中使用了 Boot 和springsecurity。
据我所知,Spring使用的是opensaml,更确切地说是opensaml 4.1.1
我在samlmaven模块的pom中添加了以下依赖项:

<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>

为了解决我的父pom中的上述依赖关系,我添加了以下仓库:

<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>

到目前为止一切都很好。当我执行maven clean install命令mvn clean install时,一切都很好,构建正确结束
当我尝试构建maven站点(mvn clean install site:site site:stage -DskipTests)时,我收到以下错误:

[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]

有人能给我解释一下为什么会出现这个错误吗?我该如何修复它?
如果找不到库,则应始终找不到它们......而不仅仅是在站点生成期间。
谢谢你
安杰洛

webghufk

webghufk1#

我知道这是两个月前的事了,但是我今天遇到了同样的事情,我想我应该分享一下对我有用的东西。并且在我的pom中引入了类似的依赖项,pom也说找不到工件。除了像最初的发布者那样在存储库部分添加shibboleth存储库之外,我还添加了与pluginRepositories相同的存储库,这使得mvn clean install site命令能够成功处理。

<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>

希望这对其他遇到它的人有帮助!

uidvcgyl

uidvcgyl2#

我只是在使用org.springframework.security:spring-security-saml2-service-provider时遇到了这种升级到Sping Boot 3的情况。
我搜索了org.opensaml:opensaml-core:4.1.1,找到了该版本here的MVN存储库索引。在“repositories”行中,它指示唯一具有此版本的存储库是Shibboleth存储库,位于https://build.shibboleth.net/maven/releases/

我在通常的Maven Central repo之后添加了该存储库,Gradle能够找到缺少的依赖项。

相关问题