Empty swagger.json generated using swagger-maven-plugin 3.1.7

752 Views Asked by At

I am using the swagger-maven-plugin 3.1.7 as follows:

<plugin>
        <groupId>com.github.kongchen</groupId>
        <artifactId>swagger-maven-plugin</artifactId>
        <version>3.1.7</version>
        <configuration>
          <apiSources>
            <apiSource>
              <springmvc>true</springmvc>
              <locations>"path to controller"</locations>
              <info>
                <title>"title"</title>
                <version>v1</version>
              </info>
              <outputPath>${project.build.directory}/swagger/client_api.json</outputPath>
              <swaggerDirectory>${project.build.directory}/swagger</swaggerDirectory>
            </apiSource>
          </apiSources>
        </configuration>
        <executions>
          <execution>
            <phase>test</phase>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

I have following swagger dependencies added

    <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.9.2</version>
    </dependency>

My controller is annotated with

@RequestMapping at class level and at method level.
@Api at the class level
@ApiOperation at the method level

But am still getting an empty swagger.json file.

This is a part of multi module project where am getting an error. Adding the same dependencies and process in a non multi module project is generating swagger.json completely fine.

Can some-one please let me know if am doing anything wrong ?

0

There are 0 best solutions below