我有一个maven多模块项目,在saml2场景中使用spring 2.6.4和spring安全性。
据我所知,spring使用opensaml,更确切地说,使用opensaml 4.1.1。
我将这个依赖项添加到我的saml maven模块的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干净安装命令时,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]有人能解释一下为什么会有这个错误吗?我怎么才能修好它?
如果找不到图书馆,就永远找不到.不仅仅是在网站生成期间。
谢谢
安杰洛
发布于 2022-05-09 21:21:13
我知道这是两个月前的事,但我今天遇到了同样的事情,我想我会分享对我有用的东西。我在1月份做过一个使用OpenSaml 4.1.1的项目,今天我开始了一个新的项目,并在pom中引入了类似的依赖项,其中还说无法找到工件。除了像最初的海报一样在存储库部分添加shibboleth存储库之外,我还添加了与pluginRepositories相同的存储库,这使得mvn clean install site命令能够成功地处理。POM片段如下所示:
<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>希望这能帮助其他遇到它的人!
https://stackoverflow.com/questions/71292868
复制相似问题