From db23d8cf788f2d1748d63e5049264d1adc8f0856 Mon Sep 17 00:00:00 2001 From: Christoph Kutzinski Date: Thu, 8 Sep 2011 17:06:12 +0200 Subject: [PATCH] Revert JENKINS-8383 as it didn't work with Maven 2 --- changelog.html | 3 -- .../maven/reporters/MavenFingerprinter.java | 35 +++---------------- 2 files changed, 4 insertions(+), 34 deletions(-) diff --git a/changelog.html b/changelog.html index feea5fe453..24518a6787 100644 --- a/changelog.html +++ b/changelog.html @@ -75,9 +75,6 @@ Upcoming changes Bundling the translation assistance plugin in the hope of increasing the contribution.
  • Introduce a fine-grained permission to control who is allowed to run the Groovy Console. -
  • - Maven jobs should include fingerprints of their parent POMs - (issue 8383)
  • Add support for maven-android-plugin integration test reports (issue 10913) diff --git a/maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java b/maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java index 51d4d96c9a..c9b0060915 100644 --- a/maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java +++ b/maven-plugin/src/main/java/hudson/maven/reporters/MavenFingerprinter.java @@ -81,12 +81,10 @@ public class MavenFingerprinter extends MavenReporter { * Mojos perform different dependency resolution, so we need to check this for each mojo. */ public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo mojo, BuildListener listener, Throwable error) throws InterruptedException, IOException { - // TODO (kutzi, 2011/09/06): it should be perfectly save to move all these records to the - // postBuild method as artifacts should only be added by mojos, but never removed/modified. - record(pom.getArtifacts(),used); + record(pom.getArtifacts(),used); record(pom.getArtifact(),produced); record(pom.getAttachedArtifacts(),produced); - record(pom.getGroupId() + ":" + pom.getArtifactId(),pom.getFile(),produced); + record(pom.getGroupId(),pom.getFile(),produced); return true; } @@ -95,11 +93,7 @@ public class MavenFingerprinter extends MavenReporter { * Sends the collected fingerprints over to the master and record them. */ public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException { - - recordParents(pom); - build.executeAsync(new BuildCallable() { - private static final long serialVersionUID = -1360161848504044869L; // record is transient, so needs to make a copy first private final Map u = used; private final Map p = produced; @@ -125,27 +119,6 @@ public class MavenFingerprinter extends MavenReporter { return true; } - private void recordParents(MavenProject pom) throws IOException, InterruptedException { - MavenProject parent = pom.getParent(); - while (parent != null) { - File parentFile = parent.getFile(); - if (parentFile == null) { - // Parent artifact contains no actual file, so we resolve against - // the local repository - parentFile = parent.getProjectBuildingRequest() - .getLocalRepository().find(parent.getArtifact()) - .getFile(); - } - // we need to include the artifact Id for poms as well, otherwise a - // project with the same groupId would override its parent's - // fingerprint - record(parent.getGroupId() + ":" + parent.getArtifactId(), - parentFile, used); - parent = parent.getParent(); - } - } - - private void record(Collection artifacts, Map record) throws IOException, InterruptedException { for (Artifact a : artifacts) record(a,record); @@ -166,14 +139,14 @@ public class MavenFingerprinter extends MavenReporter { * This method contains the logic to avoid doubly recording the fingerprint * of the same file. */ - private void record(String fileNamePrefix, File f, Map record) throws IOException, InterruptedException { + private void record(String groupId, File f, Map record) throws IOException, InterruptedException { if(f==null || files.contains(f) || !f.isFile()) return; // new file files.add(f); String digest = new FilePath(f).digest(); - record.put(fileNamePrefix+':'+f.getName(),digest); + record.put(groupId+':'+f.getName(),digest); } @Extension -- GitLab