Skip to content

Commit 3e6a9b3

Browse files
committed
Stop calling getProject() during execution of AutoConfigurationMetadata
Closes gh-40540
1 parent 2572c6d commit 3e6a9b3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationMetadata.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,6 +52,8 @@ public class AutoConfigurationMetadata extends DefaultTask {
5252

5353
private static final String COMMENT_START = "#";
5454

55+
private final String moduleName;
56+
5557
private SourceSet sourceSet;
5658

5759
private File outputFile;
@@ -66,6 +68,7 @@ public AutoConfigurationMetadata() {
6668
dependsOn((Callable<String>) () -> this.sourceSet.getProcessResourcesTaskName());
6769
getProject().getConfigurations()
6870
.maybeCreate(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME);
71+
this.moduleName = getProject().getName();
6972
}
7073

7174
public void setSourceSet(SourceSet sourceSet) {
@@ -107,7 +110,7 @@ private Properties readAutoConfiguration() throws IOException {
107110
}
108111
}
109112
autoConfiguration.setProperty("autoConfigurationClassNames", String.join(",", publicClassNames));
110-
autoConfiguration.setProperty("module", getProject().getName());
113+
autoConfiguration.setProperty("module", this.moduleName);
111114
return autoConfiguration;
112115
}
113116

0 commit comments

Comments
 (0)