Skip to content
Browse files
[JENKINS-8383] recreated changes
Originally-Committed-As: 85b9c503c02c9e44216cdba72a78f612c8299a52
  • Loading branch information
Stephan Pauxberger committed Oct 12, 2011
1 parent 4cd21e2 commit 7cd8f4e6932cb521bfe5c8b7c4441c32ba3c5e13
Showing 1 changed file with 31 additions and 5 deletions.
@@ -81,10 +81,12 @@ public boolean preBuild(MavenBuildProxy build, MavenProject pom, BuildListener l
* 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.getGroupId() + ":" + pom.getArtifactId(),pom.getFile(),produced);

return true;
@@ -93,9 +95,12 @@ public boolean postExecute(MavenBuildProxy build, MavenProject pom, MojoInfo moj
* Sends the collected fingerprints over to the master and record them.
public boolean postBuild(MavenBuildProxy build, MavenProject pom, BuildListener listener) throws InterruptedException, IOException {


build.executeAsync(new BuildCallable<Void,IOException>() {
private static final long serialVersionUID = -1360161848504044869L;

// record is transient, so needs to make a copy first
private final Map<String,String> u = used;
private final Map<String,String> p = produced;
@@ -121,6 +126,27 @@ public Void call(MavenBuild build) throws IOException, InterruptedException {
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()
// 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<Artifact> artifacts, Map<String,String> record) throws IOException, InterruptedException {
for (Artifact a : artifacts)
@@ -141,14 +167,14 @@ private void record(Artifact a, Map<String,String> record) throws IOException, I
* This method contains the logic to avoid doubly recording the fingerprint
* of the same file.
private void record(String groupId, File f, Map<String, String> record) throws IOException, InterruptedException {
private void record(String fileNamePrefix, File f, Map<String, String> record) throws IOException, InterruptedException {
if(f==null || files.contains(f) || !f.isFile())

// new file
String digest = new FilePath(f).digest();


0 comments on commit 7cd8f4e

Please sign in to comment.