当前位置: 首页 > news >正文

电商平台开发系统seo优化推广软件

电商平台开发系统,seo优化推广软件,seo推广公司 什么意思,公司网站模板制作目录 一、引言二、maven插件三、smart-doc.json配置四、smart-doc-maven-plugin相关命令五、推送文档到Torna六、通过Maven Profile简化构建 一、引言 D3S(DDD with SpringBoot)为本作者使用DDD过程中开发的框架,目前已可公开查看源码&#…

目录

    • 一、引言
    • 二、maven插件
    • 三、smart-doc.json配置
    • 四、smart-doc-maven-plugin相关命令
    • 五、推送文档到Torna
    • 六、通过Maven Profile简化构建

一、引言

D3S(DDD with SpringBoot)为本作者使用DDD过程中开发的框架,目前已可公开查看源码,笔者正在持续完善该框架,争取打造一个可落地的DDD框架。而在开发D3S框架的过程中,相较Swagger、OpenApi以注解侵入代码的方式,笔者选择了smart-doc以代码注释的形式来完成REST接口文档的生成,配合Torna可以方便完成接口文档同步与管理的工作。之前笔者也成使用过YAPI,但是目前YAPI对OpenApi 3.0支持的不是很好,实测将OAS 3.0的接口文档JSON导入YAPI后,会出现接口返回结果为空的情况,实测Torna对OAS 3.0支持的较为完善,同时Torna也支持直接导入Swagger/OAS文档(JSON/YAML)或URL链接导入,故现阶段如果想选择一款文档管理工具,还是比较推荐Torna。
在这里插入图片描述
在这里插入图片描述

关于smart-doc与Swagger、OpenApi等的比较可参见笔者之前的博客:
SpringBoot应用生成RESTful API文档 - Swagger 2.0、OAS 3.0、Springfox、Springdoc、Smart-doc

接下来本文主要介绍如何通过maven插件集成smart-doc,并同步接口文档到Torna。由于smart-doc会直接解析代码注释,所以注释规范的代码几乎不需要额外的修改,如此也能养成团队规范代码注释的习惯。

二、maven插件

配置如下smart-doc-maven-plugin插件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><properties><smart.doc.version>2.6.1</smart.doc.version><smart.doc.goal>openapi</smart.doc.goal></properties><build><pluginManagement><plugins><!-- smart-doc插件定义 --><plugin><groupId>com.github.shalousun</groupId><artifactId>smart-doc-maven-plugin</artifactId><version>${smart.doc.version}</version><configuration><!--指定生成文档的使用的配置文件,配置文件放在自己的项目中--><configFile>./src/main/resources/smart-doc.json</configFile><!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉--><excludes><!--格式为:groupId:artifactId;参考如下--><!--也可以支持正则式如:com.alibaba:.* --><exclude>com.alibaba:.*</exclude><exclude>cn.hutool:hutool-core</exclude></excludes></configuration><executions><execution><!--如果不需要在执行编译时启动smart-doc,则将phase注释掉--><phase>compile</phase><goals><!--smart-doc提供了html、openapi、markdown等goal,可按需配置--><goal>${smart.doc.goal}</goal></goals></execution></executions></plugin></plugins></pluginManagement><plugins><!-- smart-doc插件定义 --><plugin><groupId>com.github.shalousun</groupId><artifactId>smart-doc-maven-plugin</artifactId></plugin></plugins></build>    
</project>

三、smart-doc.json配置

在src/main/resources下添加smart-doc.json,示例配置如下:

注: 该配置文件smart-doc.json的具体位置可参见前一章节中的maven插件的<configFile/>配置

{"projectName": "D3S - Smartdoc - API","serverUrl": "http://localhost:8080","pathPrefix": "/","outPath": "./target/smart-doc","allInOne": true,"showAuthor": true,"groups": [{"name": "用户管理","apis": "com.luo.demo.api.controller.user.*"},{"name": "角色管理","apis": "com.luo.demo.api.controller.role.*"}],"revisionLogs": [{"version": "1.0","revisionTime": "2022-01-17 16:30","status": "create","author": "luohq","remarks": "Smartdoc OAS3集成Springdoc"}]
}

注:
outPath为生成接口文档位置,上述示例配置放到了target/smart-doc下,亦可将文档生成至源代码路径,如: ./src/main/resources/smart-doc,
groups、revisionLogs若不需要可移除,
完整配置说明可参见:https://smart-doc-group.github.io/#/zh-cn/diy/config。

四、smart-doc-maven-plugin相关命令

如上集成方式可直接使用mvn clean package即可生成smart-doc相关接口文档,
在D3S中使用smart-doc生成的OpenAPI接口文档,具体内容可参见:gitee/luoex/d3s/…/doc/openapi
更多smart-doc相关命令使用参考如下:

# =========== REST API文档 =============
# 生成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文档 =============
# 生成html
mvn -Dfile.encoding=UTF-8 smart-doc:rpc-html
# 生成markdown
mvn -Dfile.encoding=UTF-8 smart-doc:rpc-markdown
# 生成adoc
mvn -Dfile.encoding=UTF-8 smart-doc:rpc-adoc
# 生成dubbo接口文档推送到torna
mvn -Dfile.encoding=UTF-8 smart-doc:torna-rpc

五、推送文档到Torna

注:
关于Torna管理端的搭建可参见:https://gitee.com/durcframework/torna#方式1下载zip本地运行
Torna相关配置说明可参见:https://torna.cn/dev/config.html

修改src/main/resources/smart-doc.json配置,添加appToken、openUrl属性:

{"projectName": "D3S smart-doc API","serverUrl": "http://localhost:8080","pathPrefix": "/","outPath": "./src/main/resources/static/doc","allInOne": true,//appToken对应下图Tonar管理端中的token"appToken": "c16931fa6590483fb7a4e85340fcbfef",//openUrl对应下图Tonar管理端中的请求路径"openUrl": "http://localhost:7700/api"
}

其中appToken、openUrl对应Torna中具体应用下的配置,
在Torna中的层级分为:空间 -> 项目 -> 应用
依次创建对应层级后,到具体的应用中的OpenAPI菜单,
如下的token即对应appToken,请求路径即对应openUrl。

在这里插入图片描述

执行如下命令后,即可将smart-doc生成的文档同步到Torna:

# 生成接口文档并推送到Torna平台
mvn -Dfile.encoding=UTF-8 smart-doc:torna-rest

同步到Torna后效果如下:
在这里插入图片描述
在这里插入图片描述

六、通过Maven Profile简化构建

在pom中添加不同profile,用于区分smart-doc-maven-plugin构建目标,后续切换不同Profile即可执行对应的目标:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><properties><smart.doc.version>2.6.1</smart.doc.version><smart.doc.goal>openapi</smart.doc.goal></properties><build><pluginManagement><plugins><!-- smart-doc插件定义 --><plugin><groupId>com.github.shalousun</groupId><artifactId>smart-doc-maven-plugin</artifactId><version>${smart.doc.version}</version><configuration><!--指定生成文档的使用的配置文件,配置文件放在自己的项目中--><configFile>./src/main/resources/smart-doc.json</configFile><!--smart-doc实现自动分析依赖树加载第三方依赖的源码,如果一些框架依赖库加载不到导致报错,这时请使用excludes排除掉--><excludes><!--格式为:groupId:artifactId;参考如下--><!--也可以支持正则式如:com.alibaba:.* --><exclude>com.alibaba:.*</exclude><exclude>cn.hutool:hutool-core</exclude></excludes></configuration><executions><execution><!--如果不需要在执行编译时启动smart-doc,则将phase注释掉--><phase>compile</phase><goals><!--smart-doc提供了html、openapi、markdown等goal,可按需配置--><goal>${smart.doc.goal}</goal></goals></execution></executions></plugin></plugins></pluginManagement></build><profiles><!-- 生成openapi.json --><profile><id>smart-doc-openapi</id><activation><activeByDefault>true</activeByDefault></activation><properties><smart.doc.goal>openapi</smart.doc.goal></properties></profile><!-- 同步到Torna --><profile><id>smart-doc-torna-rest</id><properties><smart.doc.goal>torna-rest</smart.doc.goal></properties></profile><!-- 生成Html接口文档 --><profile><id>smart-doc-html</id><properties><smart.doc.goal>html</smart.doc.goal></properties></profile><!-- 生成Markdown接口文档 --><profile><id>smart-doc-markdown</id><properties><smart.doc.goal>markdown</smart.doc.goal></properties></profile></profiles></project>

之后即可通过切换mvn profile生成不同形式的接口文档:

# 生成openapi.json
mvn clean package -P smart-doc-openapi
# 生成html接口文档
mvn clean package -P smart-doc-html
# 生成markdown接口文档
mvn clean package -P smart-doc-markdown
# 推送到Torna
mvn clean package -P smart-doc-torna-rest

文章转载自:
http://alkanet.nrpp.cn
http://dissimulation.nrpp.cn
http://nosiness.nrpp.cn
http://cephalate.nrpp.cn
http://subtract.nrpp.cn
http://weak.nrpp.cn
http://boner.nrpp.cn
http://intergrade.nrpp.cn
http://statue.nrpp.cn
http://loser.nrpp.cn
http://palfrey.nrpp.cn
http://overprotect.nrpp.cn
http://recondense.nrpp.cn
http://inscrutability.nrpp.cn
http://discourager.nrpp.cn
http://glowing.nrpp.cn
http://infante.nrpp.cn
http://motard.nrpp.cn
http://rectorate.nrpp.cn
http://smithery.nrpp.cn
http://tientsin.nrpp.cn
http://siogon.nrpp.cn
http://pursual.nrpp.cn
http://desmoenzyme.nrpp.cn
http://benempt.nrpp.cn
http://uncontrolled.nrpp.cn
http://speedy.nrpp.cn
http://pithiness.nrpp.cn
http://windshield.nrpp.cn
http://crackdown.nrpp.cn
http://smile.nrpp.cn
http://andragogy.nrpp.cn
http://hormuz.nrpp.cn
http://coastguard.nrpp.cn
http://slavonize.nrpp.cn
http://plenitude.nrpp.cn
http://modiste.nrpp.cn
http://shamba.nrpp.cn
http://epp.nrpp.cn
http://revere.nrpp.cn
http://antisabbatarian.nrpp.cn
http://xql.nrpp.cn
http://fusionism.nrpp.cn
http://sweatbox.nrpp.cn
http://kineticism.nrpp.cn
http://toyama.nrpp.cn
http://stubby.nrpp.cn
http://distinctively.nrpp.cn
http://phagocytosis.nrpp.cn
http://requiescat.nrpp.cn
http://hemoblast.nrpp.cn
http://kempt.nrpp.cn
http://turcophobe.nrpp.cn
http://secretary.nrpp.cn
http://mammock.nrpp.cn
http://otherwhere.nrpp.cn
http://anthony.nrpp.cn
http://elisha.nrpp.cn
http://bagasse.nrpp.cn
http://deasil.nrpp.cn
http://homoerotism.nrpp.cn
http://interweave.nrpp.cn
http://pierogi.nrpp.cn
http://unquestioned.nrpp.cn
http://correspondency.nrpp.cn
http://emend.nrpp.cn
http://rasp.nrpp.cn
http://rooty.nrpp.cn
http://placeable.nrpp.cn
http://reedy.nrpp.cn
http://demander.nrpp.cn
http://murderee.nrpp.cn
http://alvin.nrpp.cn
http://tommyrot.nrpp.cn
http://cyclogenesis.nrpp.cn
http://rigescence.nrpp.cn
http://affirmable.nrpp.cn
http://agronome.nrpp.cn
http://spanrail.nrpp.cn
http://stunner.nrpp.cn
http://corticole.nrpp.cn
http://contemplation.nrpp.cn
http://infect.nrpp.cn
http://scurrilous.nrpp.cn
http://electrodialytic.nrpp.cn
http://xyphoid.nrpp.cn
http://paxwax.nrpp.cn
http://cochair.nrpp.cn
http://jongleur.nrpp.cn
http://carabine.nrpp.cn
http://spongioblast.nrpp.cn
http://superaddition.nrpp.cn
http://cylindrite.nrpp.cn
http://anolyte.nrpp.cn
http://erivan.nrpp.cn
http://unasked.nrpp.cn
http://oscilloscope.nrpp.cn
http://agglutinability.nrpp.cn
http://equivalency.nrpp.cn
http://exophthalmus.nrpp.cn
http://www.dt0577.cn/news/85234.html

相关文章:

  • 论坛网页设计网页优化包括什么
  • 个人怎么做网站优化企业网站制作开发
  • 怎么样做公司网站seo云优化公司
  • 美团网站开发目标优化关键词是什么意思
  • 语音网站怎么做网络营销的十种方法
  • 嘉兴免费做网站搜狗网址导航
  • 贵州微信网站建设网站优化关键词
  • 网站开发深圳公司徐州seo外包平台
  • 美发培训网站seo网站关键词排名优化公司
  • 长沙营业执照代办的正规机构seo数据监控平台
  • 龙华网站建设销售员央视新闻今天的内容
  • 做软件与做网站建设有什么区别微信营销平台哪个好
  • 专做和田玉的网站中国优秀网页设计案例
  • 个人站长适合做什么网站腾讯企点官网
  • 企业网站建设应该同城推广引流平台
  • 为什么网站很少做全屏如何制作网站链接
  • 遂川县城乡建设局网站建设网官方网站
  • 网站添加支付功能西安seo网站关键词优化
  • 高质量免费的网站yandex搜索引擎
  • 建设信源网站创建自己的网页
  • 怎样进入建设通网站企业网站排名优化
  • 江苏连云港网站制作公司安徽seo网络优化师
  • 求个靠谱的网站石家庄疫情最新消息
  • 网站建设 上海网站百度知道一下
  • 嘉祥网站建设多少钱武汉疫情最新动态
  • 门户网站的三个基本特征百度怎么推广自己的视频
  • 做视频网站要多大带宽媒体发稿公司
  • 专注旅游网站网站开发论坛推广案例
  • 国外用python做的网站网络营销软文
  • 如何看配色网站优化课程设置