配置依赖
增加依赖 pom.xml
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
</dependency>
添加Maven插件
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>1.5.8</version>
<executions>
<execution>
<id>generate-docs</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html</backend>
<doctype>book</doctype>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-asciidoctor</artifactId>
</dependency>
</dependencies>
</plugin>
如果要将文档打入Jar包中增加一个插件
该插件会打包到static/doc目录中
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.outputDirectory}/static/docs
</outputDirectory>
<resources>
<resource>
<directory>
${project.build.directory}/generated-docs
</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
待续
「真诚赞赏,手留余香」
标签
aframe
andrew-ng
arduino
blockchain
cgi
consul
docker
eth
ethereum
evm
feign
flask
golang
hw
java
javascript
jenkins
jpa
js
k8s
kubernetes
linux
mac
machine-learning
math
mysql
nginx
op
opentcv
ops
poco
pptp
python
rd
spring
springboot
ssl
thymeleaf
type
vagrant
vpn
vue
webrtc
workflow
技术文章
新浪博客
无聊
生活
生活记录
股票
运维