I have a feature request: in the Test task, provide a convenient way to specify system properties that should be passed on to the actual JVM running the tests (if the system property is actually set).
For example:
test {
mappedSystemProperties= [‘foo’, ‘bar’]
… }
–> In this example, if the system properties foo and bar are set, they are passed on to the test JVM, otherwise they are ignored.
Yes, this is very hard to figure out. I searched a lot to find this, and have spent quite some time to find a solution. I’m not applying a plugin, but instead setting a script variable and then using systemProperty to set the properties in the tasks. That seems like a lot of trouble to get that to hand off. Seems 1) that would be documented well as I did not see it in the manual and the search results for various search queries took a while to weed down to this one and 2) at the very minimum there would be some boolean property when defining a task that would cause this to happen. For instance, when one tries to use geb and Selenium, and they need to pass web driver properties or other system properties such as the baseUrl on the command line, then none of that works until you figure this out, and it is a time consuming debug process of a build tool that is supposed to be simpler than Maven and Ant.