How do I control the order of compile classpaths?

The only guarantee that the ‘dependencies { }’ section gives is that for a given set of dependencies, the results will be returned in a fixed but arbitrary order. ie for a given set of dependendencies, you’ll always get the same classpath, but you can’t do anything to influence the order. If you really want to mess with the order, you need to write some code to do so, like the above.