From ebf5130c1b77ccb68c8c6244a4348a42622ceaa0 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Jun 12 2012 14:22:47 +0000 Subject: Implement resolver logging --- diff --git a/JavadirWorkspaceReader.java b/JavadirWorkspaceReader.java index 5dd598c..1698929 100644 --- a/JavadirWorkspaceReader.java +++ b/JavadirWorkspaceReader.java @@ -24,7 +24,29 @@ public class JavadirWorkspaceReader implements WorkspaceReader { return workspaceRepository; } + private static final String LOG_FILE = System.getProperty("maven.resolver.logfile"); + private static final java.util.concurrent.Semaphore LOG_SEMAPHORE = new java.util.concurrent.Semaphore(1); + public File findArtifact(Artifact artifact) { + File f = findArtifactImpl(artifact); + + LOG_SEMAPHORE.acquireUninterruptibly(); + try { + if (LOG_FILE != null && f != null) { + java.io.FileOutputStream fos = new java.io.FileOutputStream(LOG_FILE, true); + java.io.PrintStream ps = new java.io.PrintStream(fos); + ps.println(f.getAbsolutePath()); + ps.close(); + } + } + catch (Exception _) {} + finally { + LOG_SEMAPHORE.release(); + return f; + } + } + + private File findArtifactImpl(Artifact artifact) { MavenJPackageDepmap.debug("=============JAVADIRREADER-FIND_ARTIFACT: " + artifact.getArtifactId()); StringBuffer path = new StringBuffer();