saker.standard Documentation TaskDoc JavaDoc Packages
  1. saker.standard
  2. Build parameters
  3. Retrieve parameter values

Retrieve parameter values

The tasks in the package allows accessing the execution and environment user parameters during the build execution.

The std.param.env() and std.param.exec() tasks can be used in the build scripts to retrieve the given user parameters respectively:

$envparam = std.param.env(example.env.parameter)
$execparam = std.param.exec(example.exec.parameter)

If we configure the build execution with the following command line:

-EUexample.env.parameter=123 -Uexample.exec.parameter=abc

The the value of $envparam will be 123, while the value of $execparam will be abc.

If the parameter for the specified name wasn't found, then the tasks will throw an appropriate exception signaling the error. You can optionally use the DefaultValue that should be returned if the parameter is not found, or specified as null.