yq 4 роки тому
батько
коміт
8b0c1b1f3f
1 змінених файлів з 64 додано та 0 видалено
  1. 64 0
      技术分享/smart接口文档工具

+ 64 - 0
技术分享/smart接口文档工具

@@ -0,0 +1,64 @@
+smart是什么?
+smart-doc是一款同时支持JAVA REST API和Apache Dubbo RPC接口文档生成的工具,
+smart-doc在业内率先提出基于JAVA泛型定义推导的理念, 完全基于接口源码来分析生成接口文档,
+不采用任何注解侵入到业务代码中。你只需要按照java-doc标准编写注释,
+smart-doc就能帮你生成一个简易明了的Markdown、HTML5、Postman Collection2.0+、OpenAPI 3.0+的文档
+项目中如何使用smart
+1.在maven的父pom中添加如下插件
+<plugin>
+                <groupId>com.github.shalousun</groupId>
+                <artifactId>smart-doc-maven-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
+                    <configFile>./src/main/resources/smart-doc.json</configFile>
+                    <!--指定项目名称-->
+                    <projectName>test</projectName>
+<!--                    <excludes>-->
+<!--                        <exclude>com.bizmatics:product-service-provider</exclude>-->
+<!--                        <exclude>cn.afterturn:easypoi-web</exclude>-->
+<!--                    </excludes>-->
+                </configuration>
+            </plugin>
+2.在web项目的src/main/resource目录下添加smart-doc.json文件
+文件内容(文件内容根据自己的项目做配置)
+{
+  "outPath":"./src/main/resources/static/doc",
+  "serverUrl": "http://127.0.0.1:8082/test",
+  "isStrict": false,
+  "coverOld": true,
+  "allInOne": true,
+  "packageFilters": "com.bizmatics.demo.controller.web",
+  "requestExample":"false",
+  "responseExample":"true",
+  "projectName": "test"
+}
+3.生成文档
+1.点击idea左侧的maven导航栏选择smart-doc,生成合适的文档工具
+2.指令
+//生成html
+mvn -Dfile.encoding=UTF-8 smart-doc:html
+//生成markdown
+mvn -Dfile.encoding=UTF-8 smart-doc:markdown
+//生成adoc
+mvn -Dfile.encoding=UTF-8 smart-doc:adoc
+//生成postman json数据
+mvn -Dfile.encoding=UTF-8 smart-doc:postman
+// 生成 Open Api 3.0+,Since smart-doc-maven-plugin 1.1.5
+mvn -Dfile.encoding=UTF-8 smart-doc:openapi
+// 生成文档推送到Torna平台
+mvn -Dfile.encoding=UTF-8 smart-doc:torna-rest
+// Apache Dubbo RPC文档
+// Generate html
+mvn -Dfile.encoding=UTF-8 smart-doc:rpc-html
+// Generate markdown
+mvn -Dfile.encoding=UTF-8 smart-doc:rpc-markdown
+// Generate adoc
+mvn -Dfile.encoding=UTF-8 smart-doc:rpc-adoc
+4.示例项目在git上的demo项目里面
+5. 官网地址
+https://gitee.com/smart-doc-team/smart-doc?_from=gitee_search
+
+
+
+