void (File jpsPluginClassesRoot, String jarNameInDistribution, List<String> moduleNames, String mavenArtifactNamePrefix, List<String> to) { File parentDir = jpsPluginClassesRoot.getParentFile(); if (jpsPluginClassesRoot.isFile()) { String fileName; if (jpsPluginClassesRoot.getName().equals("groovy-jps.jar")) { fileName = jarNameInDistribution; } else { String name = jpsPluginClassesRoot.getName(); int dotIndex = name.lastIndexOf('.'); name = dotIndex < 0 ? name : name.substring(0, dotIndex); int dashIndex = name.lastIndexOf('-'); String version = dashIndex < 0 ? null : name.substring(dashIndex + 1); fileName = mavenArtifactNamePrefix + "-" + version + ".jar"; if (parentDir.getName().equals(version)) { parentDir = new File(parentDir.getParentFile().getParentFile(), mavenArtifactNamePrefix + "/" + version); } } to.add(new File(parentDir, fileName).getPath()); } else { for (String moduleName : moduleNames) { to.add(new File(parentDir, moduleName).getPath()); } } }