Reputation: 1404
Have used springfox dependencies in my spring boot application to show up swagger ui. Used annotation like @SwaggerDefinition
and @EnableSwagger2
.
But they are not generating any html's or json/yaml or any client code. So i used plugin found at : https://github.com/kongchen/swagger-maven-example
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
......
</plugin>
But they are not helping either, i guess they are scanning for all @Api class in entire package to generate json, but i have none.
Any suggestions please ?
Upvotes: 0
Views: 5235
Reputation: 991
This worked for me with kongchen plugin
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.7</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiSources>
<apiSource>
<info>
<title>Swagger API Specification for Your Project</title>
<version>v0.28</version>
<description>Swagger API Specification for Your Project</description>
</info>
<locations>
<location>com.yourpackage.api</location>
<location>com.yourpackage.api.controllers</location>
</locations>
<springmvc>true</springmvc>
<outputFormats>json,yaml</outputFormats>
<swaggerDirectory>
${project.build.directory}/generated/swagger-api-spec
</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
</plugin>
Upvotes: 2