String () { var gradleJar = PathManager.getJarForClass(GradleConstants.class); if (gradleJar != null) { Path pathToAnt = gradleJar.resolveSibling("ant").resolve("ant.jar"); if (pathToAnt.toFile().isFile()) { return pathToAnt.toString(); } if (Files.isDirectory(gradleJar)) { // Code runs from IDEA run configuration (code from .class file in out/ directory) try { return PathUtil.getJarPathForClass(Class.forName("org.apache.tools.ant.taskdefs.Ant")); } catch (ClassNotFoundException ignore) { } } } LOG.warn("Unable to locate ant.jar for build process classpath"); return ""; }