private Artifact unify(Artifact dependent, Artifact dependency) { for (Entry<String, String> unification : unified.entrySet()) { String groupFilter = unification.getKey(); String version = unification.getValue(); String artifactId = dependency.toString(); if ("".equals(version)) { version = dependent.getVersion(); } if (artifactId.startsWith(groupFilter) && (!"".equals(version))) { Artifact retVal = new DefaultArtifact( dependency.getGroupId(), dependency.getArtifactId(), dependency.getClassifier(), dependency.getExtension(), // The important one version); retVal.setProperties(dependency.getProperties()); return retVal; } } return dependency; }
public void logGraph(String logFile) { PrintWriter writer; try { writer = new PrintWriter(logFile, "UTF-8"); writer.println("digraph loaders {"); for (Entry<String, DependentLoaderImplementation> inMap : loaderMap.entrySet()) { DependentLoaderImplementation loader = inMap.getValue(); for (DependentLoaderImplementation depedent : loader.dependencies) { if (depedent != null) writer.println("\"" + loader.artifact + "\" -> " + "\"" + depedent.artifact + "\""); else writer.println("\"" + loader.artifact + "\" -> null"); } } writer.println("}"); writer.close(); } catch (Exception e) { OutputBouble.reportError(e); } }