Maven 在 Maven Central 中找不到现有的依赖项



我有一个新的Spring Boot 2.5.3项目,遇到了一些奇怪的问题。我试图在我的pom.xml中添加此依赖项,但由于某些原因Maven 3.6.3无法解决此依赖项。

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi</artifactId>
<version>1.5.10</version>
</dependency>

当从IDE (IntelliJ)和命令提示符(bash/cmd)运行mvn clean install -U时,打印的异常是

[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.myapp:api >-----------------------
[INFO] Building MyApp API 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.237 s
[INFO] Finished at: 2021-09-10T15:07:26+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project api: Could not resolve dependencies for project com.myapp:api:jar:0.0.1-SNAPSHOT: Failure to find org.springdoc:springdoc-openapi:jar:1.5.10 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

这个依赖项存在于Maven Central中,这让事情变得很奇怪。

在Windows和CentOS操作系统的两台不同的机器上尝试,结果是相同的。

这个依赖项没有jar类型。只有POM类型。

您需要使用与Maven Central建议的相同的依赖声明:

<!-- https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi</artifactId>
<version>1.5.10</version>
<type>pom</type>
</dependency>

试着做一个maven clean install

clean目标应该重新编译项目并识别新的依赖项。如果这不起作用,请尝试关闭IDE并重新启动它。

如果依赖项实际上是在Maven中心,我有信心clean目标将工作。

这两个选项在过去解决依赖问题时都对我有效。

最新更新