TongchengOpenSource / smart-doc

Smart-doc is a java restful api document generation tool. Smart-doc is based on interface source code analysis to generate interface documentation, completely zero-injection.

Home Page:https://smart-doc-group.github.io/#/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

smart-doc gradle plugin3.0.1 generate document failed

starzxzx opened this issue · comments

Your Environment(您的使用环境)

  • smart-doc version:
  • plugin version (e.g. smart-doc-maven-plugin or smart-doc-gradle-plugin): 3.0.1
  • build tool version(maven or gradle): gradle
  • jdk version:11

Expected Behavior(您期望的结果)

使用gradle插件输出postman文档,遇到两个问题
1、提示ERROR: The codePath can't be empty.
从源码看codePath必需要配置,但default.json没有给出样例,参考测试代码配置了一个避免了这个报错,但不确定配置的是否正确
2、报如下错,class文件路径多了一个L,不知道是什么原因
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:smartDocPostman'.
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.NoClassDefFoundError: Lcom/xxxx/xxxx/xx/xxx/xxx/xxxx;
at com.ly.doc.utils.JavaClassUtil.getFieldGenericType(JavaClassUtil.java:802)

为了使用解析swagger tag的特性从2.7.0升级到了3.0.1,在2.7.7下面是可以正常生成文档的

Current Behavior(当前结果)

Possible Solution(bug解决建议)

Steps to Reproduce (Bug产生步骤,请尽量提供用例代码)

除了outPath外,配置项中增加了下面两个配置项
"codePath": "/src/main/java",
"sourceCodePaths": [
{
"path": "src/main/java"
}
]

Context(Bug影响描述)

@starzxzx Caused by: java.lang.NoClassDefFoundError: Lcom/xxxx/xxxx/xx/xxx/xxx/xxxx; This is an original Java exception, not defined by smart-doc. You can ignore the L and check if a field depends on the reported class but has not imported it.

Caused by: java.lang.NoClassDefFoundError: Lcom/xxxx/xxxx/xx/xxx/xxx/xxxx; 这个属于java原本的异常,并不是属于smart-doc定义的。可以忽略L,然后根据类名也确认下是不是某个字段依赖了这个报错的类型,但是并没过这个类。这