File tree Expand file tree Collapse file tree 2 files changed +221
-138
lines changed
swagger-codegen-maven-plugin/src/main/java/io/swagger/codegen/plugin
swagger-codegen/src/main/java/io/swagger/codegen Expand file tree Collapse file tree 2 files changed +221
-138
lines changed Original file line number Diff line number Diff line change 36
36
import config .ConfigParser ;
37
37
38
38
import java .io .File ;
39
+ import java .util .HashMap ;
39
40
import java .util .Map ;
40
41
import java .util .ServiceLoader ;
41
42
@@ -112,6 +113,9 @@ public class CodeGenMojo extends AbstractMojo {
112
113
@ Parameter (defaultValue = "true" )
113
114
private boolean addCompileSourceRoot = true ;
114
115
116
+ @ Parameter
117
+ protected Map <String , String > environmentVariables = new HashMap <String , String >();
118
+
115
119
/**
116
120
* The project being built.
117
121
*/
@@ -125,6 +129,12 @@ public void execute() throws MojoExecutionException {
125
129
CodegenConfig config = CodegenConfigLoader .forName (language );
126
130
config .setOutputDir (output .getAbsolutePath ());
127
131
132
+ if (environmentVariables != null ) {
133
+ for (String key : environmentVariables .keySet ()) {
134
+ System .setProperty (key , environmentVariables .get (key ));
135
+ }
136
+ }
137
+
128
138
if (null != templateDirectory ) {
129
139
config .additionalProperties ().put (TEMPLATE_DIR_PARAM , templateDirectory .getAbsolutePath ());
130
140
}
You can’t perform that action at this time.
0 commit comments