Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add @Option to Gradle tasks to enable command-line configuration #161

Open
vlsi opened this issue Nov 16, 2019 · 5 comments
Open

Add @Option to Gradle tasks to enable command-line configuration #161

vlsi opened this issue Nov 16, 2019 · 5 comments

Comments

@vlsi
Copy link

vlsi commented Nov 16, 2019

For instance:

./gradlew dependencyCheckAggregate --failBuildOnCVSS 8

I know failBuildOnCVSS could be specified in build.* files, however, it would be convenient if the tasks supported command-line options ( see https://docs.gradle.org/current/userguide/custom_tasks.html#sec:declaring_and_using_command_line_options )

@jeremylong
Copy link
Collaborator

This looks like it would require a LOT of refactoring of the plugin as the @Option attribute does not work with extensions. As recommended by the gradle documentation all of the configuration within the plugin is done using extensions.

@vlsi
Copy link
Author

vlsi commented Nov 24, 2019

What if keep extensions as is, but add extra @Option to the task itself?

I guess adjusting failBuildOnCVSS on the fly (e.g. for exploratory purposes) is quite a common use case.

@tdillon
Copy link

tdillon commented Nov 16, 2022

Being able to configure the plugin from the command line is needed for various CI/CD purposes such as:

  • configure properties specific to the build server
  • configure properties needed for CI/CD pipeline

Requiring each repo using this plugin to configure the properties in the build.gradle is unmanageable and possibly not allowed (e.g., passwords).

@jeremylong
Copy link
Collaborator

Would using an init-script, such as described in odc/issues#4044, work?

@tdillon
Copy link

tdillon commented Nov 23, 2022

I think an init script could be used to override/configure the plugin.

Here is a simple example to override the report formats.

init.gradle

rootProject {
  afterEvaluate { project ->
    project.dependencyCheck.formats = ['JSON']
  }
}

SonarQube's plugin configuration behavior is what we're used to. It is very handy to set properties from the command line using our CI/CD tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants