I have a new Spring Boot 2.5.3 project and got some weird issue. I am trying to add this dependency in my pom.xml, but Maven 3.6.3 can’t resolve the dependency for some reason.
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi</artifactId>
<version>1.5.10</version>
</dependency>
When running mvn clean install -U
both from IDE (IntelliJ) and command prompt (bash / cmd), the printed exception is
[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
The dependency exists in Maven Central which makes things weird.
Tried on 2 different machines with Windows and CentOS operating systems and the result is the same.
2
Answers
Try doing a
maven clean install
The clean goal should recompile the project and recognize the new dependency. If that does not work, try to close down the IDE and restart it.
If the dependency is in fact in Maven central I am confident the
clean
goal will work.Both of these options have worked for me in the past regarding dependency issues.
This dependency does not have a jar type. It’s POM type only.
You need to use the same dependency declaration as the Maven Central suggests: