Skip to content
Permalink
Browse files
[FIXED JENKINS-19251] Use hashes rather than modification time to det…
…ermine if Maven agent JARs are up to date.

(cherry picked from commit 6b6a69e)

Conflicts:
	changelog.html
  • Loading branch information
jglick authored and olivergondza committed Oct 18, 2013
1 parent 9e1e164 commit 022a98b8d3b6bcb8b0ff150ec194ee103de6fef6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
@@ -8,6 +8,7 @@
import hudson.Launcher;
import hudson.Platform;
import hudson.Proc;
import hudson.Util;
import hudson.maven.ProcessCache.NewProcess;
import hudson.model.BuildListener;
import hudson.model.Computer;
@@ -534,7 +535,7 @@ static FilePath copyJar(PrintStream log, FilePath dst, Class<?> representative,
zip.setProject(new Project());
zip.execute();
jar = t;
} else if (copiedJar.lastModified() > jar.lastModified()) {
} else if (copiedJar.exists() && copiedJar.digest().equals(Util.getDigestOf(jar))) {
log.println(seedName + ".jar already up to date");
return copiedJar;
}
@@ -26,6 +26,7 @@
import hudson.FilePath;
import hudson.Launcher;
import hudson.EnvVars;
import hudson.Util;
import hudson.maven.agent.Main;
import hudson.maven.agent.Maven21Interceptor;
import hudson.model.BuildListener;
@@ -40,7 +41,6 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;


/**
@@ -69,11 +69,10 @@ protected String getMavenAgentClassPath(MavenInstallation mvn, FilePath slaveRoo
// TODO why would we not pick it up using GetClassWorldsJar like we do for M2 on master or M3 anywhere?
FilePath jar = slaveRoot.child("classworlds.jar");
// copied to root of this JAR using dependency:generate-resources:
URLConnection conn = MavenProcessFactory.class.getClassLoader().getResource("classworlds.jar").openConnection();
if (jar.lastModified() > conn.getLastModified()) {
if (jar.exists() && jar.digest().equals(Util.getDigestOf(MavenProcessFactory.class.getClassLoader().getResourceAsStream("classworlds.jar")))) {
listener.getLogger().println("classworlds.jar already up to date");
} else {
InputStream in = conn.getInputStream();
InputStream in = MavenProcessFactory.class.getClassLoader().getResourceAsStream("classworlds.jar");
try {
jar.copyFrom(in);
} finally {

0 comments on commit 022a98b

Please sign in to comment.