gpt4 book ai didi

java - 为什么 Maven swagger 插件不扫描外部模块?

转载 作者:行者123 更新时间:2023-12-01 19:12:44 25 4
gpt4 key购买 nike

我们有一个 Maven 多模块项目,看起来大致如下:

Parent    - admin    - microserviceA     - microserviceB    - microserviceC

The microservices A, B and C expose functional specific rest endpoints.However, the admin module exposes common rest endpoints for resilience, robustness and recovery.

In order to document our APIs, we are using swagger 2.0 with the maven swagger plugin.

The pom.xml that we are using for each microservice looks like:

MicroserviceA:

<build>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger.maven.plugin}</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>
<location>com.xxx.a.resource</location>
<location>com.xxx.admin.resource</location>
</locations>
<schemes>http,https</schemes>
.....
</build>

微服务B:

<build>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger.maven.plugin}</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>
<location>com.xxx.b.resource</location>
<location>com.xxx.admin.resource</location>
</locations>
<schemes>http,https</schemes>
.....
</build>

微服务C:

<build>
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>${swagger.maven.plugin}</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>false</springmvc>
<locations>
<location>com.xxx.c.resource</location>
<location>com.xxx.admin.resource</location>
</locations>
<schemes>http,https</schemes>
.....
</build>

问题: 即使在 maven swagger 插件 <location> 中显式指定管理包,maven 插件也不会扫描管理模块级别的其余端点。 .

PS:我尝试过几个版本的maven插件。

有什么解决办法吗?

最佳答案

我认为这是 swagger 插件的一个限制,因为在他们的 Git 中打开了几个问题,但没有答案。 (自2017年)

关于java - 为什么 Maven swagger 插件不扫描外部模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59457269/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com