swagger-maven-plugin自动生成swagge.json(Jersey项目)
来源:互联网 发布:淘宝发错货买家不寄回 编辑:程序博客网 时间:2024/06/18 14:41
1,加入依赖
<!-- Swagger -->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>1.5.0</version>
</dependency>
2,加入插件
<!--增加swagger-plugin-->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>com.gionee.geip.web</locations>
<schemes>http,https</schemes>
<host>xxxx</host>
<basePath>/api</basePath>
<info>
<title>Swagger Maven Plugin Sample</title>
<version>v1</version>
<description>
This is a sample.
</description>
<termsOfService>
http://www.github.com/kongchen/swagger-maven-plugin
</termsOfService>
<contact>
<email>xxx</email>
<name>xxx</name>
<url>xxx</url>
</contact>
<license>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<name>Apache 2.0</name>
</license>
</info>
<securityDefinitions>
</securityDefinitions>
<swaggerDirectory>${basedir}/src/main/generated</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-hibernate-validations</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
</plugin>
3,加入注释
@Controller
@Path("/geip")//必须
@Api(value = "/geip", description = "Operations about WebController")//必须
public class WebController {
@Autowired
private GeipManager geipManager;
@GET
@Path("/test")
@ApiOperation(value = "test",
notes = "test"
)//必须
public String test() {
return "test";
}
}
4,执行mvn compile
- swagger-maven-plugin自动生成swagge.json(Jersey项目)
- swagger-maven-plugin自动生成swagger.json(springmvc项目)
- maven-war-plugin生成swagger。json并打包到war包中(springmvc)
- 利用Swagger Maven Plugin生成Rest API文档
- maven项目的自动生成
- 使用Swagger自动生成文档
- eclipse maven jersey项目搭建
- Swagger与SpringMVC整合自动生成api(超详细)
- spring boot rest接口自动生成文档(包含swagger)
- swagger2 离线文档 文档中心搭建 json swagger 自动生成api文档
- Spring mvc + mybatis+maven集成swagger ui自动生成api文档
- 使用wagon-maven-plugin插件自动部署项目
- 使用wagon-maven-plugin插件自动部署项目
- maven项目自动生成代码(mybatis-generator 代码自动生成)
- 使用swagger生成API的json文件
- ssm+maven项目配置mapper 自动生成
- mybatis代码自动生成Demo(maven项目)
- springboot+springfox+Swagger 实现项目的restful文档的自动生成
- jquery.deferred的用法
- Python学习笔记 --- Python获取今天与昨天的13位时间戳
- 微信小程序getPhoneNumber快速获取用户手机号组件
- 测试
- mac切换中英文快捷键
- swagger-maven-plugin自动生成swagge.json(Jersey项目)
- PathMeasure
- 拓扑排序
- webpack的最简单应用,只使用js与css的打包
- 1023:最大数问题
- 多表联查,不通过many-to-one的方法
- Linux下service的命令用法
- Collection_ArrayList
- JSP 指令