How can I set default values for parameters in my BuildServiceParameters
class? If I define an interface that implements BuildServiceParameters
, then there’s no obvious place to set defaults at all. So I tried to use a class instead of an interface, and set defaults in the constructor:
abstract class MyServiceParameters implements BuildServiceParameters {
public MyServiceParameters() {
getFileCollection().setFrom(...);
}
abstract ConfigurableFileCollection getFileCollection();
}
However, the constructor’s call to getFileCollection
fails with a NullPointerException
. So where can I set a default that will apply to all uses of my build service and its parameters?