Skip to content

Commit deffda4

Browse files
committed
Merge branch '3.1.x' into 3.2.x
Closes gh-40464
2 parents 2e114b6 + ca4d64e commit deffda4

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java

+2-2
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.
@@ -179,7 +179,7 @@ private TaskProvider<BootJar> configureBootJarTask(Project project,
179179
.provider(() -> (String) bootJar.getManifest().getAttributes().get("Start-Class"));
180180
bootJar.getMainClass()
181181
.convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent()
182-
? manifestStartClass : resolveMainClassName.get().readMainClassName()));
182+
? manifestStartClass : resolver.readMainClassName()));
183183
bootJar.getTargetJavaVersion()
184184
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
185185
bootJar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java

+3-4
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.
@@ -153,9 +153,8 @@ Provider<String> readMainClassName() {
153153
String classpath = getClasspath().filter(File::isDirectory)
154154
.getFiles()
155155
.stream()
156-
.map((directory) -> getProject().getProjectDir().toPath().relativize(directory.toPath()))
157-
.map(Path::toString)
158-
.collect(Collectors.joining(","));
156+
.map(File::getAbsolutePath)
157+
.collect(Collectors.joining(File.pathSeparator));
159158
return this.outputFile.map(new ClassNameReader(classpath));
160159
}
161160

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/WarPluginAction.java

+2-2
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.
@@ -99,7 +99,7 @@ private TaskProvider<BootWar> configureBootWarTask(Project project) {
9999
.provider(() -> (String) bootWar.getManifest().getAttributes().get("Start-Class"));
100100
bootWar.getMainClass()
101101
.convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent()
102-
? manifestStartClass : resolveMainClassName.get().readMainClassName()));
102+
? manifestStartClass : resolver.readMainClassName()));
103103
bootWar.getTargetJavaVersion()
104104
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
105105
bootWar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java

+2-2
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.
@@ -113,7 +113,7 @@ void failsGracefullyWhenNoTestMainMethodIsFound() throws IOException {
113113
else {
114114
assertThat(result.getOutput())
115115
.contains("Main class name has not been configured and it could not be resolved from classpath "
116-
+ String.join(File.separator, "build", "classes", "java", "test"));
116+
+ canonicalPathOf("build/classes/java/test"));
117117
}
118118
}
119119

0 commit comments

Comments
 (0)