dependency-check / dependency-check/DependencyCheck
Maven plugin parameter name to Settings.KEYS mapping
- Dominant language
- Java
- Stars
- 7.7k
- Forks
- 1.4k
- Avg merge
- 9d 22h
- Merged PRs (30d)
- 13
Description
From a test-consistency perspective it would be nice to have some sort of mapping that contains the maven plugin parameter name (as listed in the maven plugin's generated plugin.xml or helpmojo.xml) as the key and its equivalent [Settings.KEYS](https://github.com/jeremylong/DependencyCheck/blob/2fbee6714e115aee052a58436d85ed433bb1e36c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L81) as the value.
This is not a problem per se but requires a lot of tedium on my end when I upgrade between versions.
**Solution I'd like**
A .properties file that maps the maven plugin parameter name to the Settings.KEYS assigned value.
A .properties file would have something like this
```
...
dataDirectory=data.directory
databaseDriverName=data.driver_name
databaseDriverPath=data.driver_path
databasePassword=data.password
databaseUser=data.user
enableExperimental=analyzer.experimental.enabled
enableRetired=analyzer.retired.enabled
failBuildOnAnyVulnerability=fail.build.on.any.vulnerability
failBuildOnCVSS=fail.build.on.cvss
failOnError=fail.on.error
...
```
With this, I can then efficiently construct parameters for the plugin that looks at the Settings object's value and determines if the assigned value is equal to the default value defined in the plugin, if it is not then pass that value on to the plugin.
**Alternatives I've considered**
Currently creating a .properties file by manually looking at the code in BaseDependencyCheckMojo and Settings.KEYS.
Considered a feature request where plugin parameter names are the camelCase equivalent as the Settings.KEYS
i.e. ```analyzerArtifactoryEnabled``` instead of ```artifactoryAnalyzerEnabled``` for the plugin maps to ```analyzer.artifactory.enabled```.
The other solution I've considered submitting as a feature request is to use the _alias_ property in the ```@Parameter``` annotation on the fields of BaseDependencyCheckMojo that can map to a Settings.KEYS.
Example:
```java
@Parameter(property = "databasePassword", alias="data.password")
private String databasePassword;
```
Contributor guide
Assessment
This issue has not been assessed yet.