From cba91ab28e7ccdb2dbc809f249a640b14ee15eba Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 25 Oct 2019 12:52:49 +0100 Subject: [PATCH] Stop Created-By manifest header from causing a test task cache miss Previously, when a project's jar was an input into a test task, a cache hit required the current build to be using the same JDK as the one that created the cache entry. This was due to the Created-By entry in the jar's manifest which will vary if JDKs with different values for the java.version and java.specification.vendor version are used. This commit configures normalization of the runtime classpath to ignore META-INF/MANIFEST.MF, thereby allowing a cache hit when the tests were previously run on a different JDK than the one being used now. Typically this is a different update release being used on a CI agent and a developer's machine. This change will therefore improve the likelihood of a cache hit once remote caching has been enabled. Closes gh-23872 --- gradle/spring-module.gradle | 6 ++++++ integration-tests/integration-tests.gradle | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/gradle/spring-module.gradle b/gradle/spring-module.gradle index 486a3c38f1b..c70263e18c0 100644 --- a/gradle/spring-module.gradle +++ b/gradle/spring-module.gradle @@ -18,6 +18,12 @@ jar { } } +normalization { + runtimeClasspath { + ignore "META-INF/MANIFEST.MF" + } +} + javadoc { description = "Generates project-level javadoc for use in -javadoc jar" diff --git a/integration-tests/integration-tests.gradle b/integration-tests/integration-tests.gradle index 6e285d8471a..ab3bba7354b 100644 --- a/integration-tests/integration-tests.gradle +++ b/integration-tests/integration-tests.gradle @@ -20,3 +20,9 @@ dependencies { testCompile("org.hsqldb:hsqldb") testCompile("org.hibernate:hibernate-core") } + +normalization { + runtimeClasspath { + ignore "META-INF/MANIFEST.MF" + } +}