Sync Maven binaries rather than copying them

This prevents binaries accumulating in build/maven-binaries when
the versions of Maven that are tested changes.

Closes gh-41649
This commit is contained in:
Andy Wilkinson 2024-08-15 16:58:21 +01:00
parent c1aaff1b73
commit 98773cdde9
1 changed files with 10 additions and 7 deletions

View File

@ -40,13 +40,16 @@ public abstract class PrepareMavenBinaries extends DefaultTask {
@TaskAction @TaskAction
public void prepareBinaries() { public void prepareBinaries() {
for (String version : getVersions().get()) { getProject().sync((sync) -> {
Configuration configuration = getProject().getConfigurations() sync.into(getOutputDir());
.detachedConfiguration( for (String version : getVersions().get()) {
getProject().getDependencies().create("org.apache.maven:apache-maven:" + version + ":bin@zip")); Configuration configuration = getProject().getConfigurations()
getProject() .detachedConfiguration(getProject().getDependencies()
.copy((copy) -> copy.into(getOutputDir()).from(getProject().zipTree(configuration.getSingleFile()))); .create("org.apache.maven:apache-maven:" + version + ":bin@zip"));
} sync.from(getProject().zipTree(configuration.getSingleFile()));
}
});
} }
} }