Gradle uses the Maven style of dependency resolution. Instead of having all the libraries you use in a single directory in your project or floating around your filesystem, you tell it what libraries you want to depend on, where those libraries are available, and when they should be used (e.g. when compiling, only at runtime, only when running tests, etc.).
So what does the “compile pathfinder()” line do?
“compile” tells the build system that the library it’s given is required for the project to compile and run. There are other instructions like “runtime” that means the library is required for the project to run, but not needed at compile time; and “compileOnly” for libraries only needed to compile, but aren’t needed on the runtime classpath.
The “pathfinder()” method is basically an alias for a dependency on Jaci’s pathfinder library. In typical Gradle projects, depending on the pathfinder library would roughly look something like this:
compile group: 'jaci.pathfinder', name: 'Pathfinder-Java', version: '1.8'
runtime group: 'jaci.pathfinder', name: 'Pathfinder-JNI', version: '1.8'
This line will only tell the build system what library to use - it does not tell it where to find the JAR file, source code, javadocs, etc. At build time, Gradle will search for the library in a local cache - this is what timtim17 posted above. If the library isn’t cached, then Gradle will look for it in the available Maven repositories. GradleRIO automatically makes the WPILib maven servers available.
For example, if you want to depend on gauva - a very popular Java library with lots of different quality-of-life utilities - your build.gradle file would look like
repositories {
mavenCentral()
}
dependencies {
compile group: 'com.google.guava', name: 'guava', version: '27.0-jre'
}
Gradle will also automatically pull in all the libraries that guava depends on.
With the Ant/Eclipse build system that we used to have, you would need to track down the guava JAR, put it in the libs folder, then do the same for every library that guava uses, and for all the libraries that those libraries need, and so on. This is a huge pain and is called “JAR hell” if you forget to add a JAR file, or worse, use the JAR from an incompatible version of the library.
Side note: the convenience methods “wpilib()”, “ctre()”, and “navx()” are similar to “pathfinder()” in that they all add a bunch of dependencies for the libraries you want to use without needing to keep track of their real names, locations, and version numbers.