1、pom.xml 文件導入插入包 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchem ...
1、pom.xml 文件導入插入包
<?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"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.6</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.tring</groupId> <artifactId>ysyn</artifactId> <version>0.0.1-SNAPSHOT</version> <name>ysyn</name> <description>ysyn</description> <properties> <java.version>1.8</java.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring-boot.version>2.3.7.RELEASE</spring-boot.version> <jjwt.version>0.9.0</jjwt.version> <alibaba-druid-version>1.2.6</alibaba-druid-version> <jwt.version>1.0.9.RELEASE</jwt.version> <fastjson.version>1.2.68</fastjson.version> <commons-io.version>2.6</commons-io.version> <mybatis-plus.version>3.4.2</mybatis-plus.version> <mybatis-plus-generator.version>3.4.1</mybatis-plus-generator.version> <velocity.version>1.7</velocity.version> <sa-token.version>1.27.0</sa-token.version> <mybatis-plus-extension>3.5.2</mybatis-plus-extension> </properties> <dependencies> <!--web 相關的--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> </dependency> <!--lombok 提供get/set 以及午餐構造器等--> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <!-- mysql連接驅動 --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!-- Druid 連接池 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>${alibaba-druid-version}</version> </dependency> <!-- Mybatis-Plus 依賴 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-boot-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- Mybatis-Plus 多行插入 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-extension</artifactId> <version>${mybatis-plus-extension}</version> </dependency> <!-- mybatis-plus 代碼生成 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-generator</artifactId> <version>${mybatis-plus-generator.version}</version> </dependency> <!-- vm模版 --> <dependency> <groupId>org.apache.velocity</groupId> <artifactId>velocity</artifactId> <version>${velocity.version}</version> </dependency> <!-- StringUtils 工具 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> <!-- JSON工具 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>${fastjson.version}</version> </dependency> <!-- JWT依賴 --> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-jwt</artifactId> <version>${jwt.version}</version> </dependency> <dependency> <groupId>io.jsonwebtoken</groupId> <artifactId>jjwt</artifactId> <version>${jjwt.version}</version> </dependency> <!-- Sa-Token 許可權認證, 線上文檔:http://sa-token.dev33.cn/ --> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-spring-boot-starter</artifactId> <version>${sa-token.version}</version> </dependency> <!-- Sa-Token 整合 Redis (使用jackson序列化方式) --> <dependency> <groupId>cn.dev33</groupId> <artifactId>sa-token-dao-redis-jackson</artifactId> <version>${sa-token.version}</version> </dependency> <!-- 提供Redis連接池 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-pool2</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId> </dependency> <dependency> <groupId>com.google.zxing</groupId> <artifactId>core</artifactId> <version>3.3.3</version> </dependency> <!-- hutool --> <dependency> <groupId>cn.hutool</groupId> <artifactId>hutool-all</artifactId> <version>5.5.7</version> </dependency> <!--easypoi用於excel數據導入導出支持圖片類型,性能沒有easyExcel好,但是easyExcel不支持圖片,看業務需求選一個,現在用的是easyexcel--> <!-- 阿裡開源的excel操作依賴 --> <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>2.2.6</version> </dependency> <!--<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>4.0.0</version> </dependency> <!– https://mvnrepository.com/artifact/org.apache.poi/poi –> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>4.0.0</version> </dependency> <!– easy poi –> <dependency> <groupId>cn.afterturn</groupId> <artifactId>easypoi-base</artifactId> <version>4.1.3</version> <scope>compile</scope> </dependency>--> <!--swagger2--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version> </dependency> <!--swagger2 UI--> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> <!-- <!–樹工具包–>--> <!-- <dependency>--> <!-- <groupId>xin.altitude.cms</groupId>--> <!-- <artifactId>ucode-cms-common</artifactId>--> <!-- <version>1.5.8.3</version>--> <!-- </dependency>--> </dependencies> <build> <plugins> <plugin> <groupId>com.github.shalousun</groupId> <artifactId>smart-doc-maven-plugin</artifactId> <version>2.4.4</version> <configuration> <!--指定生成文檔的使用的配置文件,配置文件放在自己的項目中--> <configFile>./src/main/resources/smart-doc.json</configFile> <!--指定項目名稱--> <projectName>ysyn</projectName> <!--smart-doc實現自動分析依賴樹載入第三方依賴的源碼,如果一些框架依賴庫載入不到導致報錯,這時請使用excludes排除掉--> <excludes> <!--格式為:groupId:artifactId;參考如下--> <!--也可以支持正則式如:com.alibaba:.* --> <exclude>com.alibaba:fastjson</exclude> </excludes> <!--includes配置用於配置載入外部依賴源碼,配置後插件會按照配置項載入外部源代碼而不是自動載入所有,因此使用時需要註意--> <!--smart-doc能自動分析依賴樹載入所有依賴源碼,原則上會影響文檔構建效率,因此你可以使用includes來讓插件載入你配置的組件--> <includes> <!-- 使用了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> <!-- 該插件的主要功能是進行項目的打包發佈處理 --> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <!-- 設置程式執行的主類 --> <configuration> <mainClass>com.tring.ysyn.YsynApplication</mainClass> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
2、創建smark doc 配置文件(位置自己再pom文件中定義)註:具體參數可以參考官網:https://smart-doc-group.github.io/#/zh-cn/start/quickstart
{ "outPath": "./src/main/resources/md" }
3、打開maven執行(一般選用markdowm)
4、帶個剛剛配置的位置
./src/main/resources/md