为什么OpenAPI官方配置在编译时找不到符号
我正在使用Open API生成Swagger Docs,我按照官方文档进行构图:
package misc.config.openapi;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* https://springdoc.org/
* https://github.com/springdoc/springdoc-openapi
*/
@Configuration
public class OpenApiConfig {
@Bean
public GroupedOpenApi fortuneApi() {
return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
}
}
这是文档页面。当我编译项目时,显示这样的错误:
> Configure project :dolphin-acientbay
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-post
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-template
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Task :dolphin-common:compileJava FAILED
/Users/xiaoqiangjiang/source/reddwarf/backend/retire/dolphin-common/src/main/java/misc/config/openapi/OpenApiConfig.java:16: error: cannot find symbol
return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
^
symbol: method group(String)
location: class Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dolphin-common:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
9 actionable tasks: 6 executed, 3 up-to-date
IntellijID没有提供任何错误提示,为什么不能编译该项目?我该怎么办来解决这个问题?我想念什么吗?这是我正在使用的依赖项:
api "org.springdoc:springdoc-openapi-ui:1.6.9"
api "org.springdoc:springdoc-openapi-webmvc-core:1.2.32"
I am using open api to generate the swagger docs, I follow the official documents to config like this:
package misc.config.openapi;
import org.springdoc.core.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* https://springdoc.org/
* https://github.com/springdoc/springdoc-openapi
*/
@Configuration
public class OpenApiConfig {
@Bean
public GroupedOpenApi fortuneApi() {
return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
}
}
this is the docs page. when I compile the project, shows error like this:
> Configure project :dolphin-acientbay
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-post
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Configure project :dolphin-template
/Users/xiaoqiangjiang/source/reddwarf/backend/retire
> Task :dolphin-common:compileJava FAILED
/Users/xiaoqiangjiang/source/reddwarf/backend/retire/dolphin-common/src/main/java/misc/config/openapi/OpenApiConfig.java:16: error: cannot find symbol
return GroupedOpenApi.builder().group("Fortune").pathsToMatch("/fortune/**").build();
^
symbol: method group(String)
location: class Builder
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dolphin-common:compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
9 actionable tasks: 6 executed, 3 up-to-date
the Intellij IDE did not give any error tips, why could not compile the project? what should I do to fixed this problem? Am I missing something? this is the dependencies I am using:
api "org.springdoc:springdoc-openapi-ui:1.6.9"
api "org.springdoc:springdoc-openapi-webmvc-core:1.2.32"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论