无法从公司的 nexus 存储库获取 Maven 依赖项

问题描述 投票:0回答:1

我正在尝试构建 Spring Boot 应用程序,该应用程序有多个依赖项驻留在 Maven 公共和公司的 Nexus 存储库上。但我每次都会遇到以下错误,我正在尝试解决依赖关系:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.springframework.cloud:spring-cloud-contract-maven-plugin:4.0.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.cloud:spring-cloud-contract-maven-plugin:jar:4.0.2 -> org.springframework.cloud:spring-cloud-contract-verifier:jar:4.0.2 -> com.toomuchcoding.jsonassert:jsonassert:jar:0.6.2 -> com.jayway.jsonpath:json-path:jar:2.7.0 -> org.slf4j:slf4j-api:jar:[2.0.0,) @
 @
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[ERROR] Unresolveable build extension: Plugin org.springframework.cloud:spring-cloud-contract-maven-plugin:4.0.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.cloud:spring-cloud-contract-maven-plugin:jar:4.0.2 -> org.springframework.cloud:spring-cloud-contract-verifier:jar:4.0.2 -> com.toomuchcoding.jsonassert:jsonassert:jar:0.6.2 -> com.jayway.jsonpath:json-path:jar:2.7.0 -> org.slf4j:slf4j-api:jar:[2.0.0,) @

    at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:389)
    at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:349)
    at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:340)
    at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:76)
    at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:448)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:197)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
[ERROR]
[ERROR]   The project com.xxx.xxx:XXXXXXXX:2.0.${revision} (<PATH_TO_PROJECT>\pom.xml) has 1 error
[ERROR]     Unresolveable build extension: Plugin org.springframework.cloud:spring-cloud-contract-maven-plugin:4.0.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.cloud:spring-cloud-contract-maven-plugin:jar:4.0.2 -> org.springframework.cloud:spring-cloud-contract-verifier:jar:4.0.2 -> com.toomuchcoding.jsonassert:jsonassert:jar:0.6.2 -> com.jayway.jsonpath:json-path:jar:2.7.0 -> org.slf4j:slf4j-api:jar:[2.0.0,): No versions available for org.slf4j:slf4j-api:jar:[2.0.0,) within specified range -> [Help 2]
org.apache.maven.plugin.PluginManagerException: Plugin org.springframework.cloud:spring-cloud-contract-maven-plugin:4.0.2 or one of its dependencies could not be resolved: Failed to collect dependencies at org.springframework.cloud:spring-cloud-contract-maven-plugin:jar:4.0.2 -> org.springframework.cloud:spring-cloud-contract-verifier:jar:4.0.2 -> com.toomuchcoding.jsonassert:jsonassert:jar:0.6.2 -> com.jayway.jsonpath:json-path:jar:2.7.0 -> org.slf4j:slf4j-api:jar:[2.0.0,)

令人惊讶的是,我团队中的其他开发人员能够毫无问题地获取依赖项。事实上,settings.xml 对于我们所有人来说也是一样的!!

java spring spring-boot microservices maven-3
1个回答
0
投票

我找到了核心问题。实际上,我在 3 个不同的编辑器上打开了我的 settings.xml 文件,当我进行 Maven 全新安装时,该文件被覆盖了。文件的不一致引发了这个问题!!

© www.soinside.com 2019 - 2024. All rights reserved.