问题
i'm trying to add springfox/swagger to my spring boot app, however when added to pom file, versions of dependencies are not recognized by maven. Unfortunatley i couldn't find the reason behind it. Here fragment of my pom file:
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.0.2</version>
</dependency>
Versions are marked red as not recognized by maven. What might be te reason behind such behavior? I'm using maven 3.3.9.
回答1:
These artifacts are present in Maven Repository so you should be able to add them as dependencies. There are three possible causes for this behaviour:
- You have defined custom repositories in your
pom.xml
. - Your have a customized maven configuration in your IDE.
- You have defined a custom list of repositories (it can happen if you use something like
Nexus
to provide libraries) in yoursettings.xml
maven configuration file.
I've also checked the Springfox Reference, and you can directly add this custom repository:
<repositories>
<repository>
<id>jcenter-snapshots</id>
<name>jcenter</name>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
来源:https://stackoverflow.com/questions/52544761/swagger-dependency-not-recognized-by-maven