-
Notifications
You must be signed in to change notification settings - Fork 0
Get Start
hsjfans edited this page Jun 9, 2019
·
3 revisions
只需要配置要扫描的项目路径以及文档的输出路径即可.
String realPath = "/Volumes/doc/projects/java/api";
Config config = new Config();
config.setPackageName(realPath);
config.setDocName("xxx接口文档");
config.setGradle(true);
config.setGradlePath("");
Parser parser = new SpringParser(config);
ApiTree apiTree = parser.parse(config.getPackageName(),true);
Generator generator = new HtmlGenerator();
generator.from(apiTree,config);
public class Config {
/**
* package name
*/
private String packageName;
/**
* the path to store the generated docs
*
* default is src/static/
*/
private String outPath = "src/static/";
/**
* the path of classes files
*/
private String classPath;
/**
* api doc name - xxx 接口文档
*/
private String docName;
}
config
内的字段解释:
-
packageName
带扫描的文件路径 `src`上一层 -
classPath
class 文件路径,由于要是有类加载器所以要指定编译过的classes 文件路径
,默认是${packageName}/out/production/classes
-
outPath
生成文档的地址,默认是本项目的 "src/static/" 文件夹 -
docName
生成的接口文档名称
详见 [javaparser](https://github.com/hsjfans/api-doc/wiki/JavaParser)