Browse Source

Merge branch '3.2.x'

Closes gh-40465
pull/40472/head
Andy Wilkinson 2 years ago
parent
commit
eb23d3cf59
  1. 4
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/JavaPluginAction.java
  2. 7
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/ResolveMainClassName.java
  3. 4
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/WarPluginAction.java
  4. 4
      spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/test/java/org/springframework/boot/gradle/tasks/run/BootTestRunIntegrationTests.java

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -179,7 +179,7 @@ final class JavaPluginAction implements PluginApplicationAction {
.provider(() -> (String) bootJar.getManifest().getAttributes().get("Start-Class")); .provider(() -> (String) bootJar.getManifest().getAttributes().get("Start-Class"));
bootJar.getMainClass() bootJar.getMainClass()
.convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent() .convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent()
? manifestStartClass : resolveMainClassName.get().readMainClassName())); ? manifestStartClass : resolver.readMainClassName()));
bootJar.getTargetJavaVersion() bootJar.getTargetJavaVersion()
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility())); .set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
bootJar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts()); bootJar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -153,9 +153,8 @@ public class ResolveMainClassName extends DefaultTask {
String classpath = getClasspath().filter(File::isDirectory) String classpath = getClasspath().filter(File::isDirectory)
.getFiles() .getFiles()
.stream() .stream()
.map((directory) -> getProject().getProjectDir().toPath().relativize(directory.toPath())) .map(File::getAbsolutePath)
.map(Path::toString) .collect(Collectors.joining(File.pathSeparator));
.collect(Collectors.joining(","));
return this.outputFile.map(new ClassNameReader(classpath)); return this.outputFile.map(new ClassNameReader(classpath));
} }

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -99,7 +99,7 @@ class WarPluginAction implements PluginApplicationAction {
.provider(() -> (String) bootWar.getManifest().getAttributes().get("Start-Class")); .provider(() -> (String) bootWar.getManifest().getAttributes().get("Start-Class"));
bootWar.getMainClass() bootWar.getMainClass()
.convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent() .convention(resolveMainClassName.flatMap((resolver) -> manifestStartClass.isPresent()
? manifestStartClass : resolveMainClassName.get().readMainClassName())); ? manifestStartClass : resolver.readMainClassName()));
bootWar.getTargetJavaVersion() bootWar.getTargetJavaVersion()
.set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility())); .set(project.provider(() -> javaPluginExtension(project).getTargetCompatibility()));
bootWar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts()); bootWar.resolvedArtifacts(runtimeClasspath.getIncoming().getArtifacts().getResolvedArtifacts());

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

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2023 the original author or authors. * Copyright 2012-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -113,7 +113,7 @@ class BootTestRunIntegrationTests {
else { else {
assertThat(result.getOutput()) assertThat(result.getOutput())
.contains("Main class name has not been configured and it could not be resolved from classpath " .contains("Main class name has not been configured and it could not be resolved from classpath "
+ String.join(File.separator, "build", "classes", "java", "test")); + canonicalPathOf("build/classes/java/test"));
} }
} }

Loading…
Cancel
Save