Maven Swagger swagger-codegen-plugin only generate model and controller

I'm using maven-codegen-plugin just to generate from my yml file the interface for the controller and model files. This is a java spring-boot proyect.

The pluging Configuration:

<plugin>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-codegen-maven-plugin</artifactId>
    <version>2.4.10</version>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
            <configuration>
                <inputSpec>${project.basedir}/src/main/resources/api.yml</inputSpec>
                <output>${project.build.directory}/generated-sources/swagger</output>
                <language>spring</language>
                <configOptions>
                    <java8>true</java8>
                    <interfaceOnly>true</interfaceOnly>
                    <dateLibrary>java</dateLibrary>
                </configOptions>
                <modelPackage>${project.groupId}.blabla.model</modelPackage>
                <apiPackage>${project.groupId}.blabla.controller</apiPackage>
            </configuration>
        </execution>
    </executions>
</plugin>

The point is that within my target/generated-sources directory/swagger is generating a lot of files that I don't need such as:

The files that I just needs are the files generated within src/main/java.... basically Model and controller packages.

enter image description here

How i can configure the plugging not to generate such files?

Thank you in advance

Upvotes: 3

Views: 4807

Answers (1)

Vasko Angeleski
Vasko Angeleski

Reputation: 36

You should add the following code:

<configuration>
 <skipOverwrite>true</skipOverwrite>
</configuration>

To avoid the pom.xml and readme.md to be overwritten

and the rest of the files under .gitIgnore

Upvotes: 2

Related Questions