Browse Source

Polish "Exclude spring-boot-devtools from AOT processing with Maven"

See gh-46533
pull/47162/head
Stéphane Nicoll 3 months ago
parent
commit
4498b46512
  1. 44
      build-plugin/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java
  2. 6
      build-plugin/spring-boot-maven-plugin/src/intTest/projects/aot-exclude-devtools/pom.xml
  3. 7
      build-plugin/spring-boot-maven-plugin/src/intTest/projects/aot-test-exclude-devtools/pom.xml

44
build-plugin/spring-boot-maven-plugin/src/intTest/java/org/springframework/boot/maven/AotTests.java

@ -166,6 +166,17 @@ class AotTests { @@ -166,6 +166,17 @@ class AotTests {
});
}
@TestTemplate
void whenAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
mavenBuild.project("aot-exclude-devtools").goals("package").execute((project) -> {
Path aotDirectory = project.toPath().resolve("target/spring-aot/main");
assertThat(aotDirectory).exists();
Path sourcesDirectory = aotDirectory.resolve("sources");
assertThat(sourcesDirectory).exists();
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
});
}
@TestTemplate
void whenAotTestRunsSourcesAndResourcesAreGenerated(MavenBuild mavenBuild) {
mavenBuild.project("aot-test").goals("test").execute((project) -> {
@ -180,6 +191,17 @@ class AotTests { @@ -180,6 +191,17 @@ class AotTests {
});
}
@TestTemplate
void whenTestAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
mavenBuild.project("aot-test-exclude-devtools").goals("process-test-classes").execute((project) -> {
Path aotDirectory = project.toPath().resolve("target/spring-aot/test");
assertThat(aotDirectory).exists();
Path sourcesDirectory = aotDirectory.resolve("sources");
assertThat(sourcesDirectory).exists();
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
});
}
List<Path> collectRelativePaths(Path sourceDirectory) {
try (Stream<Path> pathStream = Files.walk(sourceDirectory)) {
return pathStream.filter(Files::isRegularFile)
@ -195,26 +217,4 @@ class AotTests { @@ -195,26 +217,4 @@ class AotTests {
return contentOf(new File(project, "target/build.log"));
}
@TestTemplate
void whenAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
mavenBuild.project("aot-exclude-devtools").goals("package").execute((project) -> {
Path aotDirectory = project.toPath().resolve("target/spring-aot/main");
assertThat(aotDirectory).exists();
Path sourcesDirectory = aotDirectory.resolve("sources");
assertThat(sourcesDirectory).exists();
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
});
}
@TestTemplate
void whenTestAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
mavenBuild.project("aot-test-exclude-devtools").goals("process-test-classes").execute((project) -> {
Path aotDirectory = project.toPath().resolve("target/spring-aot/test");
assertThat(aotDirectory).exists();
Path sourcesDirectory = aotDirectory.resolve("sources");
assertThat(sourcesDirectory).exists();
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
});
}
}

6
build-plugin/spring-boot-maven-plugin/src/intTest/projects/aot-exclude-devtools/pom.xml

@ -38,11 +38,5 @@ @@ -38,11 +38,5 @@
<version>@project.version@</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>@jakarta-servlet.version@</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

7
build-plugin/spring-boot-maven-plugin/src/intTest/projects/aot-test-exclude-devtools/pom.xml

@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
<version>@project.version@</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-test</artifactId>
@ -50,11 +51,5 @@ @@ -50,11 +51,5 @@
<version>@junit-jupiter.version@</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>@jakarta-servlet.version@</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Loading…
Cancel
Save