task pathingJar(type: Jar , dependsOn: 'cleanPathingJar') { /** * If the gradle_user_home env var has been set to * C:\ on a Win7 machine, we may not have permission to write the jar to * this directory, so we will write it to the caches subdir instead. * This assumes a caches subdir containing the jars * will always exist. */ gradleUserHome = new File(gradle.getGradleUserHomeDir(), "caches") relativeClasspathEntries = configurations.compile.files.collect { new File(gradleUserHome.getAbsolutePath()).toURI(). relativize(new File(it.getAbsolutePath()).toURI()).getPath() } appendix = "pathing" destinationDir = gradleUserHome doFirst { manifest { attributes "Class-Path": relativeClasspathEntries.join(" ") } } } compileGroovy { dependsOn(pathingJar) classpath = files(pathingJar.archivePath) }