kongchen / swagger-maven-plugin

JAX-RS & SpringMVC supported maven build plugin, helps you generate Swagger JSON and API document in build phase.
http://kongchen.github.io/swagger-maven-plugin/
Apache License 2.0
763 stars 451 forks source link

Why maven swagger plugin isn't scanning external modules? #800

Open MHM01 opened 4 years ago

MHM01 commented 4 years ago

We have a maven multimodule project which looks approximatively like that:

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>

MicroserviceB:

<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>

MicroserviceC:

<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>

Problem : The maven plugin isn't scanning the rest endpoints at the admin module level even by specifying explicitly the admin package in the maven swagger plugin <location>.

PS: I've tried several version of maven plugin.

Is there any solution?

Ankzz commented 4 years ago

Facing the same issue.

MHM01 commented 4 years ago

@Ankzz, Looks like it's known limitation of the Swagger plugin.

ghost commented 3 years ago

is there any solution for this issue?

Mohamed-Massmoudi commented 3 years ago

@dshishkaryan, Unfortunately No.