程序员一直以来都有一个烦恼,只想写代码,不想写文档。代码就表达了我的思想和灵魂。
Python提出了一个方案,叫 docstring ,来试图解决这个问题。即编写代码,同时也能写出文档,保持代码和文档的一致。docstring说白了就是一堆代码中的注释。Python的docstring可以通过help函数直接输出一份有格式的文档,本工具的思想与此类似。
Apigcc是一个 非侵入 的RestDoc文档生成工具。工具通过分析代码和注释,获取文档信息,生成RestDoc文档。
<!-- https://mvnrepository.com/artifact/com.github.apiggs/apiggs -->
<dependency>
<groupId>com.github.apiggs</groupId>
<artifactId>apiggs</artifactId>
<version>1.6</version>
</dependency>
<plugin>
<groupId>com.github.apiggs</groupId>
<artifactId>apiggs-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>apiggs</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- options in there -->
<id>example</id>
<version>${version}</version>
<description>示例接口文档,使用默认模板</description>
<title>示例接口文档</title>
</configuration>
</plugin>