Specified java.library.path not used when JUnit task has include filter

I have some JUnit test tasks that I’ve defined, like this:

    task "test"(type: Test) {
      systemProperty "java.library.path", "${libsDir}/${nextConfig}/${nextArch}"
      outputs.upToDateWhen { false }
      workingDir buildDir

They run successfully. Now I want to run just a subset of the tests, so I add an include filter, like this:

include “**/SomeTests

And the tests fail with UnsatisfiedLinkError. When I run the task with --info, I can see that the raw command line is in fact specifying the correct java.library.path in both instances.

What is really strange is that this problem seems specific to Windows. I can run the same task on my Mac, and the tests always succeed, whether I’m running the full suite or just a subset.

I should have specified that I’m using Gradle 2.7 on both Mac and Windows. I have also tried 2.8, and the behavior is the same.