In Gradle there is a task that is called via cmd with parameters, for example, gradle taskWithParameters -Pparametr1 = 1234

How to call this task from another task with parameters? (parameters are predefined, can be set in code)

  • one
    Parameters are attributed to the project, i.e. are properties of the project. In one task, write the parameter to the property of the project, in the other, respectively, to extract? - Sergey

1 answer 1

The parameters passed through -P are the properties of the project. Accordingly, they can be pulled from any task simply by their names (in your case, parametr1 ).

https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_properties_and_system_properties