title: swagger-codegen files location
body: <p>I am playing with swagger-codegen on a project and I end up asking myself a question: Is there any convention for the location of the swagger files?</p>
  
  <p>Here is my case:<br>
  I'm using Maven for my project, so I have the standard Maven structure:</p>
  
  <pre><code>pom.xml
  src
  |--main
     |--java
     |--resources
     |--webapp
  |--test
     |--java
     |--resources
  </code></pre>
  
  <p>To make my REST API generated with Swagger, I have to put the swagger.json, some mustache templates and the .swagger-codegen-ignore somewhere. I have put them (naturally?) in src/main/resources:</p>
  
  <pre><code>resources
  |--api
     |--v2
        |--swagger.json
  |--swaggerconfig
     |--api.mustache
     |--[...]
  |--.swagger-codegen-ignore
  </code></pre>
  
  <p>I have configured my pom.xml with the proper swagger-codegen-maven-plugin and set the packaging to war so I get my war generated (in order to deploy it in Tomcat). An extract:</p>
  
  <pre><code>[...]
  &lt;packaging&gt;war&lt;/packaging&gt;
  [...]
  &lt;build&gt;
    &lt;finalName&gt;my-project&lt;/finalName&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;io.swagger&lt;/groupId&gt;
        &lt;artifactId&gt;swagger-codegen-maven-plugin&lt;/artifactId&gt;
        &lt;version&gt;2.2.1&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;phase&gt;generate-sources&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;generate&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;inputSpec&gt;${basedir}/src/main/resources/api/v2/swagger.json&lt;/inputSpec&gt;
              &lt;language&gt;jaxrs&lt;/language&gt;
              &lt;templateDirectory&gt;${basedir}/src/main/resources/swaggerconfig&lt;/templateDirectory&gt;
              &lt;addCompileSourceRoot&gt;true&lt;/addCompileSourceRoot&gt;
              &lt;configOptions&gt;
                &lt;library&gt;jersey2&lt;/library&gt;
              &lt;/configOptions&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
      &lt;!-- .swagger-codegen-ignore must be located at the root as per documentation --&gt;
      &lt;plugin&gt;
        &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
        &lt;version&gt;3.0.2&lt;/version&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;copy-resources&lt;/id&gt;
            &lt;phase&gt;validate&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;copy-resources&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;outputDirectory&gt;${basedir}/target/generated-sources/swagger&lt;/outputDirectory&gt;
              &lt;resources&gt;
                &lt;resource&gt;
                  &lt;directory&gt;${basedir}/src/main/resources&lt;/directory&gt;
                  &lt;includes&gt;
                    &lt;include&gt;.swagger-codegen-ignore&lt;/include&gt;
                  &lt;/includes&gt;
                &lt;/resource&gt;
              &lt;/resources&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>After a <code>mvn install</code> my swagger generated files are generated and compiled successfully, the war gets generated and is working fine.<br>
  However, in the generated war, inside WEB-INF/classes folder I find my api and swaggerconfig folders, and the .swagger-codegen-ignore. Well, this is normal as they were packaged in the src/main/resources.</p>
  
  <p>Long story short: Should I put those files elsewhere (like a src/main/swagger so Maven does find them by default)? Should I write some inclusion/exclusion rules in a maven-war-plugin (but I feel like this is not a good practice)? I have found no clear documentation on this on swagger Github.</p>
  
  <p>Thanks</p>