Swagger dependency not recognized by maven

蓝咒 提交于 2019-12-11 01:59:35

问题


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:

  1. You have defined custom repositories in your pom.xml.
  2. Your have a customized maven configuration in your IDE.
  3. You have defined a custom list of repositories (it can happen if you use something like Nexus to provide libraries) in your settings.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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!