The run task adds a --patch-modules jvm argument to the java process to allow it to access its resources. However, it seems that the option is ignored when the argument is added after the --modules argument.
Simply switching the arguments allows the java process to access its resources again.