String (Collection<String> compilationClassPath) { if (!"true".equals(System.getProperty("groovyc.reuse.compiler.classes", "true"))) { return null; } List<String> groovyJars = ContainerUtil.findAll(compilationClassPath, s -> { String fileName = PathUtilRt.getFileName(s); return (GROOVY_ALL_JAR_PATTERN.matcher(fileName).matches() || GROOVY_JAR_PATTERN.matcher(fileName).matches()) && !GROOVY_ECLIPSE_BATCH_PATTERN.matcher(fileName).matches() && !GROOVY_JPS_PLUGIN_JARS_PATTERN.matcher(fileName).matches() ; }); LOG.debug("Groovy jars: " + groovyJars); String singleJar = ContainerUtil.getOnlyItem(groovyJars); if (singleJar == null) { // avoid complications caused by caching classes from several groovy versions in classpath return null; } String fileName = PathUtilRt.getFileName(singleJar); if (GROOVY_ALL_JAR_PATTERN.matcher(fileName).matches()) { return singleJar; } Matcher matcher = GROOVY_JAR_PATTERN.matcher(fileName); if (matcher.matches()) { String version = matcher.group(2); if (version != null && version.startsWith("2.5")) { return singleJar; } } return null; }