diff --git a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java index eee0137049..4946191282 100644 --- a/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java +++ b/buildSrc/src/main/java/org/springframework/build/api/ApiDiffPlugin.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -131,8 +131,9 @@ public class ApiDiffPlugin implements Plugin { } private File getOutputFile(String baseLineVersion, Project project) { - Path outDir = Paths.get(project.getRootProject().getBuildDir().getAbsolutePath(), - "reports", "api-diff", + String buildDirectoryPath = project.getRootProject() + .getLayout().getBuildDirectory().getAsFile().get().getAbsolutePath(); + Path outDir = Paths.get(buildDirectoryPath, "reports", "api-diff", baseLineVersion + "_to_" + project.getRootProject().getVersion()); return project.file(outDir.resolve(project.getName() + ".html").toString()); } diff --git a/settings.gradle b/settings.gradle index faf5f6446e..8f9f81e27c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -41,7 +41,8 @@ rootProject.children.each {project -> settings.gradle.projectsLoaded { gradleEnterprise { buildScan { - File buildDir = settings.gradle.rootProject.getBuildDir() + File buildDir = settings.gradle.rootProject + .getLayout().getBuildDirectory().getAsFile().get() buildDir.mkdirs() new File(buildDir, "build-scan-uri.txt").text = "(build scan not generated)" buildScanPublished { scan ->