title: How to regenerate the source spring boot server-code from swagger-codegen-maven-plugin with modified swagger definition
body: <p>My requirement is that I have to generate the springboot server code from a swagger definition. I have generated the code with the help of below-mentioned command (by using swagger-codegen-cli-2.3.1.jar).</p>
  
  <pre><code>java -jar swagger-codegen-cli-2.3.1.jar generate ^
       -i nycemoves.yml ^
       --api-package com.nyce.moves.api ^
       --model-package com.nyce.moves.model ^
       --invoker-package com.nyce.moves.invoker ^
       --group-id com.nyce.moves ^
       --artifact-id nyce-moves ^
       --artifact-version 0.0.1-SNAPSHOT ^
       -l spring ^
       --library spring-boot ^
       -o nyce-moves
  </code></pre>
  
  <p>Now, we have updated the swagger definition and want to re-generate the resulting models and api-invokers, for this we would like to use a maven plugin.
  After looking through various answers on the internet, we came across the following build plugins which we have added in our pom.xml.</p>
  
  <pre><code>&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.3.1&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;inputSpec&gt;src/main/resources/nycemoves.yml&lt;/inputSpec&gt;
                          &lt;language&gt;spring&lt;/language&gt;
                          &lt;basePackage&gt;${default.package}&lt;/basePackage&gt;
                          &lt;modelPackage&gt;${default.package}.model&lt;/modelPackage&gt;
                          &lt;apiPackage&gt;${default.package}.api&lt;/apiPackage&gt;
                          &lt;invokerPackage&gt;${default.package}.invoker&lt;/invokerPackage&gt;
                          &lt;configOptions&gt;
                              &lt;interfaceOnly&gt;true&lt;/interfaceOnly&gt;
                              &lt;dateLibrary&gt;java8&lt;/dateLibrary&gt;
                              &lt;java8&gt;true&lt;/java8&gt;
                              &lt;library&gt;spring-boot&lt;/library&gt;
                              &lt;serializableModel&gt;true&lt;/serializableModel&gt;
                              &lt;sourceFolder&gt;src/main/java&lt;/sourceFolder&gt;                              
                          &lt;/configOptions&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;
  </code></pre>
  
  <p>Now, when we do mvn clean package, we want it to update / override all the models, api and invokers. But, this is not working. We are seeing the below mentioned exception.</p>
  
  <pre><code>[INFO] 16 errors
  [INFO] -------------------------------------------------------------
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 7.516 s
  [INFO] Finished at: 2019-03-06T15:05:58+05:30
  [INFO] Final Memory: 34M/448M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project nyce-moves: Compilation failure: Compilation failure:
  [ERROR] /nyce-moves/src/main/java/com/nyce/moves/api/CommentsApi.java:[29,8] duplicate class: com.nyce.moves.api.CommentsApi
  [ERROR] /nyce-moves/target/generated-sources/swagger/src/main/java/com/nyce/moves/model/PostRequest.java:[19,8] duplicate class: com.nyce.moves.model.PostRequest
  ...
  </code></pre>
  
  <p>So, we actually need the plugin to do the following things, but we are not able to figure it out. 
  a) When we run mvn clean package it should regenerate all the source-code for the server stub in source folder as well as target folder.
  b) In case of the class already exists, it should override them. We would like to handle the override later with the help of .swagger-codegen-ignore.</p>
  
  <p>I know there are lots of discussion threads on this on stackoverflow, but I could not find any solution which can help me here. Please help me on this or direct me to the relevant thread.</p>