swagger-codegen
swagger-codegen copied to clipboard
Environment variables are not properly reset by Maven plugin
Description
Environment variables set using the environmentVariables parameter remain in effect across multiple executions of the Maven plugin.
Swagger-codegen version
latest 2.2.3-SNAPSHOT
Swagger declaration file content or url
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<environmentVariables>debugSwagger</environmentVariables>
</configuration>
</execution>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
Command line used for generation
mvn generate-sources
Steps to reproduce
- Create a maven project with the plugin configuration shown above.
- Run
mvn generate-sources. - The
debugSwaggerflag remains in effect for the second execution.
Related issues
#5151 is a similar bug with other parameters of the Maven build and was fixed in #5152
Suggest a Fix
Reset environment variables to their original value after plugin execution. Pull request follows.