Skip to content

Commit 4498b46

Browse files
committed
Polish "Exclude spring-boot-devtools from AOT processing with Maven"
See gh-46533
1 parent 99cf0e3 commit 4498b46

File tree

3 files changed

+23
-34
lines changed
  • build-plugin/spring-boot-maven-plugin/src/intTest

3 files changed

+23
-34
lines changed

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ void whenAotRunsWithClassProxyClassesAreCopiedToTargetClasses(MavenBuild mavenBu
166166
});
167167
}
168168

169+
@TestTemplate
170+
void whenAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
171+
mavenBuild.project("aot-exclude-devtools").goals("package").execute((project) -> {
172+
Path aotDirectory = project.toPath().resolve("target/spring-aot/main");
173+
assertThat(aotDirectory).exists();
174+
Path sourcesDirectory = aotDirectory.resolve("sources");
175+
assertThat(sourcesDirectory).exists();
176+
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
177+
});
178+
}
179+
169180
@TestTemplate
170181
void whenAotTestRunsSourcesAndResourcesAreGenerated(MavenBuild mavenBuild) {
171182
mavenBuild.project("aot-test").goals("test").execute((project) -> {
@@ -180,6 +191,17 @@ void whenAotTestRunsSourcesAndResourcesAreGenerated(MavenBuild mavenBuild) {
180191
});
181192
}
182193

194+
@TestTemplate
195+
void whenTestAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
196+
mavenBuild.project("aot-test-exclude-devtools").goals("process-test-classes").execute((project) -> {
197+
Path aotDirectory = project.toPath().resolve("target/spring-aot/test");
198+
assertThat(aotDirectory).exists();
199+
Path sourcesDirectory = aotDirectory.resolve("sources");
200+
assertThat(sourcesDirectory).exists();
201+
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
202+
});
203+
}
204+
183205
List<Path> collectRelativePaths(Path sourceDirectory) {
184206
try (Stream<Path> pathStream = Files.walk(sourceDirectory)) {
185207
return pathStream.filter(Files::isRegularFile)
@@ -195,26 +217,4 @@ protected String buildLog(File project) {
195217
return contentOf(new File(project, "target/build.log"));
196218
}
197219

198-
@TestTemplate
199-
void whenAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
200-
mavenBuild.project("aot-exclude-devtools").goals("package").execute((project) -> {
201-
Path aotDirectory = project.toPath().resolve("target/spring-aot/main");
202-
assertThat(aotDirectory).exists();
203-
Path sourcesDirectory = aotDirectory.resolve("sources");
204-
assertThat(sourcesDirectory).exists();
205-
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
206-
});
207-
}
208-
209-
@TestTemplate
210-
void whenTestAotRunsWithDevtoolsInClasspathItIsExcluded(MavenBuild mavenBuild) {
211-
mavenBuild.project("aot-test-exclude-devtools").goals("process-test-classes").execute((project) -> {
212-
Path aotDirectory = project.toPath().resolve("target/spring-aot/test");
213-
assertThat(aotDirectory).exists();
214-
Path sourcesDirectory = aotDirectory.resolve("sources");
215-
assertThat(sourcesDirectory).exists();
216-
assertThat(collectRelativePaths(sourcesDirectory)).isNotEmpty();
217-
});
218-
}
219-
220220
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,5 @@
3838
<version>@project.version@</version>
3939
<optional>true</optional>
4040
</dependency>
41-
<dependency>
42-
<groupId>jakarta.servlet</groupId>
43-
<artifactId>jakarta.servlet-api</artifactId>
44-
<version>@jakarta-servlet.version@</version>
45-
<scope>provided</scope>
46-
</dependency>
4741
</dependencies>
4842
</project>

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
<version>@project.version@</version>
3939
<optional>true</optional>
4040
</dependency>
41+
4142
<dependency>
4243
<groupId>org.springframework.boot</groupId>
4344
<artifactId>spring-boot-test</artifactId>
@@ -50,11 +51,5 @@
5051
<version>@junit-jupiter.version@</version>
5152
<scope>test</scope>
5253
</dependency>
53-
<dependency>
54-
<groupId>jakarta.servlet</groupId>
55-
<artifactId>jakarta.servlet-api</artifactId>
56-
<version>@jakarta-servlet.version@</version>
57-
<scope>provided</scope>
58-
</dependency>
5954
</dependencies>
6055
</project>

0 commit comments

Comments
 (0)