1

I want to skip gradle files creation when I generate REST client using swagger-codgen-maven-plugin, is there an option or a plugin configuration that can be used so that Gradle and associated files are not generated?

My pom.xml

<plugin>
<groupId>io.swagger.codgen.V3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.21</version>
<executions>
    <execution>
        <goals>
            <goal>generate</goal>
        </goals>
        <configuration>
            <inputSpec>${basedir}/src/main/resources/test.yaml</inputSpec>
            <language>java</language>
            <library>resttemplate</library>
            <output>{basedir}</output>

            <apiPackage>com.restclient.api</apiPackage>
            <modelPackage>com.restclient.model</modelPackage>
            <invokerPackage>com.restclient.invoker</invokerPackage>

            <generateApiTests>false</generateApiTests>
            <generateModelTests>false</generateModelTests>
            <generateApiDocumentation>false</generateApiDocumentation>
            <generateModelDocumentation>false</generateModelDocumentation>
            <configOptions>
                <dateLibrary>java8</dateLibrary>
            </configOptions>
        </configuration>
    </execution>
</executions>

After lunch mvn clean install I found in my project root directory a lot Gradle files

  __ my_project_root_directory
  |__ README.md
  |__ build.gradle
  |__ build.sbt
  |__ docs
  |__ git_push.sh
  |__ gradle
  |__ gradle.properties
  |__ gradlew
  |__ gradlew.bat
  |__ pom.xml
  |__ settings.gradle
  |__ src
     |__ main
        |__ java
          |__ com.restclient.api
  • 2
    Have you tried using the [.swagger-codegen-ignore](https://github.com/swagger-api/swagger-codegen/tree/3.0.0#ignore-file-format) file? The `.swagger-codegen-ignore file` must exist in the root of the output directory. – Helen Sep 14 '20 at 10:12
  • Great Helen. Yes and it works very well with the files. But I can't skip the creation of folders like docs or gradle. Or maybe I got something wrong when I set the pattern? I used es. docs/ in .swagger-codegen-ignore file – greatgonzoitaly Sep 16 '20 at 11:41

1 Answers1

0

This seems to be a known issue with the plugin itself: https://github.com/swagger-api/swagger-codegen/issues/10178

So there's no way to exclude generating Gradle project files with this plugin. It will generate both always.

Cisco
  • 20,972
  • 5
  • 38
  • 60