[cli] Add --global-property for -D replacement (#5687)

-D option has been deprecated as it was previously used to:

* Pass "system properties"
* Pass additional properties

This was confusing because we already have --additional-properties and
because Java System Properties are passed as -D before program
arguments.

Confusion around the -D option had existed for some time, but when we
introduced the thread-safe GlobalSettings to avoid overwriting Java
System Properties, we created a hard break from Java System Properties
in the generator. This also disconnected the previous "system
properties" from accepting additional properties.

Once these newly deprecated methods are removed, we will have a clear
separation of concerns between:

* Java System Properties
* Global generator properties (used as workflow context)
* Additional properties (used as generator options)

This commit marks multiple places for cleanup in 5.0. These will be
breaking changes, and lower effort to break in 5.0 with deprecation
warnings now rather than adding sibling properties throughout the code
and potentially introducing logic errors.
This commit is contained in:
Jim Schubert
2020-04-01 23:11:02 -04:00
committed by GitHub
parent e14e5fccf3
commit 2957dd4d45
6 changed files with 58 additions and 12 deletions

View File

@@ -408,6 +408,7 @@ public class CodeGenMojo extends AbstractMojo {
@Parameter(defaultValue = "true", property = "openapi.generator.maven.plugin.addCompileSourceRoot")
private boolean addCompileSourceRoot = true;
// TODO: Rename to global properties in version 5.0
@Parameter
protected Map<String, String> environmentVariables = new HashMap<>();