- smart-doc 可选配置
参考:https://smart-doc-group.github.io/#/zh-cn/diy/config
1.安装IDEA插件(更为方便)
2./src/main/resources/目录下 创建 smart-doc.json
如:(更多配置参考官方文档:https://smart-doc-group.github.io/#/zh-cn/diy/config)
{
"projectName": "项目设计文档名",
"serverUrl": "",
"pathPrefix": "",
"isStrict": false,
"allInOne": true,
"outPath": "生成路径",
"coverOld": true,
"createDebugPage": true,
"packageFilters": "",
"md5EncryptedHtmlName": false,
"style":"xt256",
"skipTransientField": true,
"sortByTitle":false,
"showAuthor":false,
"packageExcludeFilters": "",
"inlineEnum":true,
"requestExample":"false",
"responseExample":"false",
"showAuthor": false,
"revisionLogs": [
{
"version": "1.0",
"status": "更新中...",
"Description": "版本描述"
}
],
"sourceCodePaths": [
{
"path": "src/main/java",
"desc": "描述"
}
]
}
- 在启动模块的pom.xml文件中添加插件配置
<plugin>
<groupId>com.github.shalousun</groupId>
<artifactId>smart-doc-maven-plugin</artifactId>
<version>[最新版本]</version>
<configuration>
<!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
<configFile>./src/main/resources/smart-doc.json</configFile>
<!--指定项目名称-->
<projectName>测试</projectName>
<!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉-->
<excludes>
<!--格式为:groupId:artifactId;参考如下-->
<!--也可以支持正则式如:com.alibaba:.* -->
<exclude>com.alibaba:fastjson</exclude>
</excludes>
<!--includes配置用于配置加载外部依赖源码,配置后插件会按照配置项加载外部源代码而不是自动加载所有,因此使用时需要注意-->
<!--smart-doc能自动分析依赖树加载所有依赖源码,原则上会影响文档构建效率,因此你可以使用includes来让插件加载你配置的组件-->
<includes>
<!--格式为:groupId:artifactId;参考如下-->
<!--也可以支持正则式如:com.alibaba:.* -->
<!-- 使用了mybatis-plus的Page分页需要include所使用的源码包 -->
<include>com.baomidou:mybatis-plus-extension</include>
<!-- 使用了mybatis-plus的IPage分页需要include mybatis-plus-core-->
<include>com.baomidou:mybatis-plus-core</include>
<!-- 如果配置了includes的情况下, 使用了jpa的分页需要include所使用的源码包 -->
<include>org.springframework.data:spring-data-commons</include>
</includes>
</configuration>
<executions>
<execution>
<!--如果不需要在执行编译时启动smart-doc,则将phase注释掉-->
<phase>compile</phase>
<goals>
<!--smart-doc提供了html、openapi、markdown等goal,可按需配置-->
<goal>html</goal>
</goals>
</execution>
</executions>
</plugin>
- 选择生成文件格式,等待在.json文件指定路径下的文件生成
- 若是生成的md文件,转word报错,可先转成pdf格式再转成doc