If your build.gradle file declares the dependency as shown, that jar will be available on the compile classpath when Gradle compiles your project Java code. There is nothing special that needs to done having declared the dependency in Gradle.
Inside your your jar, there should be a folder structure with your class files like:
/name/of/package/NameOfClass.class
Therefore, the consuming Java file should contain: