swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
http://swagger.io
Apache License 2.0
7.36k stars 2.17k forks source link

swagger-maven-plugin aggregates OpenAPI definition in multimodule project #3331

Open amarkevich opened 4 years ago

amarkevich commented 4 years ago

During multimodule project build each swagger-maven-plugin execution contain info from previous child module(s).

<swagger.version>2.0.10</swagger.version>

Parent POM:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-jaxrs2</artifactId>
                <version>${swagger.version}</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>jakarta.ws.rs</groupId>
                <artifactId>jakarta.ws.rs-api</artifactId>
                <version>2.1.6</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>io.swagger.core.v3</groupId>
                    <artifactId>swagger-maven-plugin</artifactId>
                    <version>${swagger.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>resolve</goal>
                            </goals>
                            <configuration>
                                <outputPath>${project.build.outputDirectory}</outputPath>
                                <outputFileName>${project.artifactId}</outputFileName>
                            </configuration>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.google.code.findbugs</groupId>
                            <artifactId>jsr305</artifactId>
                            <version>3.0.2</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

Child POM:

    <build>
        <plugins>
            <plugin>
                <groupId>io.swagger.core.v3</groupId>
                <artifactId>swagger-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
ahoehma commented 3 months ago

@amarkevich I found a similar effect - https://github.com/swagger-api/swagger-core/issues/4647