@@ -15,7 +15,34 @@ configurations {
15
15
// Downgrade SLF4J is required for tests to run in Eclipse
16
16
resolutionStrategy. force(" org.slf4j:slf4j-api:1.7.36" )
17
17
}
18
- all {
18
+ modernGradleRuntimeClasspath {
19
+ extendsFrom runtimeClasspath
20
+ canBeConsumed = false
21
+ canBeResolved = true
22
+ }
23
+ modernGradleRuntimeElements {
24
+ extendsFrom configurations. implementation, configurations. runtimeOnly
25
+ canBeConsumed = true
26
+ canBeResolved = false
27
+ attributes {
28
+ attribute(Category . CATEGORY_ATTRIBUTE , project. objects. named(Category , Category . LIBRARY ))
29
+ attribute(Bundling . BUNDLING_ATTRIBUTE , project. objects. named(Bundling , Bundling . EXTERNAL ))
30
+ attribute(TargetJvmVersion . TARGET_JVM_VERSION_ATTRIBUTE , 17 )
31
+ attribute(LibraryElements . LIBRARY_ELEMENTS_ATTRIBUTE , project. objects. named(LibraryElements , LibraryElements . JAR ))
32
+ attribute(Usage . USAGE_ATTRIBUTE , project. objects. named(Usage , Usage . JAVA_RUNTIME ))
33
+ attribute(GradlePluginApiVersion . GRADLE_PLUGIN_API_VERSION_ATTRIBUTE , project. objects. named(GradlePluginApiVersion , " 8.7" ))
34
+ }
35
+ outgoing. artifacts. addAll(configurations. runtimeElements. outgoing. artifacts)
36
+ }
37
+ runtimeElements {
38
+ attributes {
39
+ attribute(GradlePluginApiVersion . GRADLE_PLUGIN_API_VERSION_ATTRIBUTE , project. objects. named(GradlePluginApiVersion , " 7.5" ))
40
+ }
41
+ }
42
+ all { configuration ->
43
+ if (configuration. name == ' modernGradleRuntimeClasspath' ) {
44
+ return
45
+ }
19
46
resolutionStrategy {
20
47
eachDependency { dependency ->
21
48
// Downgrade Jackson as Gradle cannot cope with 2.15.0's multi-version
@@ -33,6 +60,10 @@ configurations {
33
60
}
34
61
}
35
62
63
+ components. java. addVariantsFromConfiguration(configurations. modernGradleRuntimeElements) {
64
+ mapToMavenScope(" runtime" )
65
+ }
66
+
36
67
dependencies {
37
68
implementation(project(" :spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform" ))
38
69
implementation(project(" :spring-boot-project:spring-boot-tools:spring-boot-loader-tools" ))
@@ -147,3 +178,18 @@ artifacts {
147
178
toolchain {
148
179
maximumCompatibleJavaVersion = JavaLanguageVersion . of(20 )
149
180
}
181
+
182
+ publishing {
183
+ publications. matching { it. name == ' pluginMaven' }. configureEach {
184
+ versionMapping {
185
+ allVariants {
186
+ fromResolutionOf(JavaPlugin . RUNTIME_CLASSPATH_CONFIGURATION_NAME )
187
+ }
188
+ }
189
+ versionMapping {
190
+ variant(GradlePluginApiVersion . GRADLE_PLUGIN_API_VERSION_ATTRIBUTE , project. objects. named(GradlePluginApiVersion , " 8.7" )) {
191
+ fromResolutionOf(" modernGradleRuntimeClasspath" )
192
+ }
193
+ }
194
+ }
195
+ }
0 commit comments