java smart-doc文档生成

maven 加入 插件

  <build>
      <plugin>
        <groupId>com.ly.smart-doc</groupId>
        <artifactId>smart-doc-maven-plugin</artifactId>
        <version>3.0.5</version>
      </plugin>
    </plugins>
  </build>

ant 通过mvn 执行smart-doc

	<target name="docTornaTest">
		<exec executable="mvn.cmd">
			<arg value="-DconfigFile=smart-doc/smart-test.json" />
			<arg value="-DprojectName=临时系统" />
			<arg value="smart-doc:torna-rest" />
		</exec>
	</target>

smart-doc json 配置

{
  "serverUrl": "127.0.0.1:8081",
  "allInOne": true,
  "isStrict": false,
  "coverOld": true,
  "framework": "solon",
  "outPath": "smart-doc/doc",
  "recursionLimit": 7,
  "requestExample": "true",
  "responseExample": "true",
  "openUrl": "http://localhost:7700/api",
  "appToken": "fe5ecfaa177945e6a5d13148b00a0800",
  "debugEnvName": "本地环境",
  "debugEnvUrl": "http://192.168.0.24:8081",
  "tornaDebug": true,
  "replace": true,
  "revisionLogs": [
    {
      "version": "1.0",
      "status": "use",
      "author": "ma",
      "revisionTime": "2024-06-07 17:29:03",
      "remarks": "测试"
    },
    {
      "version": "1.1",
      "status": "use",
      "author": "ma",
      "revisionTime": "2024-06-17 17:29:03",
      "remarks": "测试更新"
    }
  ],
  "errorCodeDictionaries": [
    {
      "title": "title",
      "enumClassName": "com.account.common.ErrorCode",
      "codeField": "code",
      "descField": "msg"
    }
  ],
  "dataDictionaries": [
    {
      "title": "PlatFormType",
      "enumClassName": "com.account.common.PlatformType",
      "codeField": "id",
      "descField": "name"
    }
  ],
  "customResponseFields": [
    {
      "name": "name",
      "desc": "desc",
      "ownerClassName": "com.newticee.sys.account.common.Result",
      "value": "value"
    }
  ],
  "packageFilters": "com.account.controller.StartController.start*",
  "requestHeaders": [
		{
			"name": "authorization",
			"type": "string",
			"desc": "系统使用",
			"required": true,
			"since": "1.0",
			"excludePathPatterns": "/user/loginAccount,/user/vipList,/out/**,/start/**"
		}
	]
}

部分配置理解

  • packageFilters 配置过滤controller,结尾加* 可以过滤method
  • customResponseFields 通用返回类
  • dataDictionaries 字典
  • errorCodeDictionaries 错误码
  • requestHeaders 请求头设置
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值