Search code examples
javamavenswaggerswagger-uispringfox

Swagger dependency not recognized by maven


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.


Solution

  • 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>