Skip to content

Commit 01b33bf

Browse files
committed
Disable snapshot caching when checking upgrade version alignment
1 parent 24242b7 commit 01b33bf

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

  • buildSrc/src/main/java/org/springframework/boot/build/bom

buildSrc/src/main/java/org/springframework/boot/build/bom/Library.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.File;
2020
import java.util.ArrayList;
2121
import java.util.Arrays;
22+
import java.util.Collection;
2223
import java.util.Collections;
2324
import java.util.HashMap;
2425
import java.util.HashSet;
@@ -27,6 +28,7 @@
2728
import java.util.Map;
2829
import java.util.Set;
2930
import java.util.TreeMap;
31+
import java.util.concurrent.TimeUnit;
3032
import java.util.function.Function;
3133
import java.util.regex.Matcher;
3234
import java.util.regex.Pattern;
@@ -428,6 +430,13 @@ public interface VersionAlignment {
428430

429431
Set<String> resolve();
430432

433+
default Configuration alignmentConfiguration(Project project, Collection<Dependency> dependencies) {
434+
Configuration alignmentConfiguration = project.getConfigurations()
435+
.detachedConfiguration(dependencies.toArray(new Dependency[0]));
436+
alignmentConfiguration.getResolutionStrategy().cacheChangingModulesFor(0, TimeUnit.SECONDS);
437+
return alignmentConfiguration;
438+
}
439+
431440
}
432441

433442
/**
@@ -492,8 +501,7 @@ public Set<String> resolve() {
492501

493502
private Map<String, String> resolveAligningDependencies() {
494503
List<Dependency> dependencies = getAligningDependencies();
495-
Configuration alignmentConfiguration = this.project.getConfigurations()
496-
.detachedConfiguration(dependencies.toArray(new Dependency[0]));
504+
Configuration alignmentConfiguration = alignmentConfiguration(this.project, dependencies);
497505
Map<String, String> versions = new HashMap<>();
498506
ResolutionResult resolutionResult = alignmentConfiguration.getIncoming().getResolutionResult();
499507
for (DependencyResult dependency : resolutionResult.getAllDependencies()) {
@@ -605,8 +613,7 @@ public Set<String> resolve() {
605613
if (this.alignedVersions != null) {
606614
return this.alignedVersions;
607615
}
608-
Configuration alignmentConfiguration = this.project.getConfigurations()
609-
.detachedConfiguration(getAligningDependencies().toArray(new Dependency[0]));
616+
Configuration alignmentConfiguration = alignmentConfiguration(this.project, getAligningDependencies());
610617
Set<File> files = alignmentConfiguration.resolve();
611618
if (files.size() != 1) {
612619
throw new IllegalStateException(

0 commit comments

Comments
 (0)