Thank you for your reply - I created an
environment task as you suggested and discovered that the problem was with my IDE rather than Gradle.
The behaviour you describe for Gradle is exactly what I would expect and exactly how Gradle behaves if I invoke it from a terminal window. However, if I invoke Gradle from within my IDE, the PATH is different…
This is because I’m starting my IDE from the Mac OS X Dock rather than from a Unix shell.
In order for my IDE to pick up the PATH from my environment, I need to start it from a terminal window like this:
open -a 'IntelliJ IDEA
This is a known problem - see for example:
In principle, I should be able to fix this by configuring my IDE to run Gradle tasks with a particular PATH, but apparently, IDEA invokes Gradle via the Tool API, which didn’t allow you to specify a PATH prior to Gradle 3.5:
It’s not obvious whether the current version of IDEA provides a way of configuring the PATH for Gradle tasks, so invoking IDEA using
open -a seem to be the best solution for now…
I hope this additional information is helpful to someone.