File tree Expand file tree Collapse file tree
src/main/java/uk/gov/hmcts/tools Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,6 +36,26 @@ public static void apply(Project project) {
3636 project .getPlugins ().apply (DependencyCheckPlugin .class );
3737
3838 DependencyCheckExtension extension = project .getExtensions ().getByType (DependencyCheckExtension .class );
39+
40+ Project root = project .getRootProject ();
41+
42+ // Gradle property: -PdependencyCheck.nvd.apiKey=...
43+ String apiKey = (String ) root .findProperty ("dependencyCheck.nvd.apiKey" );
44+
45+ // JVM system property: -DdependencyCheck.nvd.apiKey=...
46+ if (apiKey == null || apiKey .isBlank ()) {
47+ apiKey = System .getProperty ("dependencyCheck.nvd.apiKey" );
48+ }
49+
50+ // Environment variable
51+ if (apiKey == null || apiKey .isBlank ()) {
52+ apiKey = System .getenv ("NVD_API_KEY" );
53+ }
54+
55+ if (apiKey != null && !apiKey .isBlank ()) {
56+ extension .getNvd ().setApiKey (apiKey );
57+ }
58+
3959 extension .setFailBuildOnCVSS (0f );
4060
4161 // Match the CNP pipeline which disables these checks
You can’t perform that action at this time.
0 commit comments