[maven] Implement resolver logging

Stanislav Ochotnicky sochotni at fedoraproject.org
Tue Jun 12 14:48:13 UTC 2012


commit ebf5130c1b77ccb68c8c6244a4348a42622ceaa0
Author: Mikolaj Izdebski <mizdebsk at redhat.com>
Date:   Mon Jun 11 20:49:09 2012 +0200

    Implement resolver logging

 JavadirWorkspaceReader.java |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)
---
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();


More information about the scm-commits mailing list