Allow jars to be marked as a development-tool to exclude from uber-jar

Closes gh-47320
This commit is contained in:
Phillip Webb
2025-09-24 16:38:44 -07:00
parent d27aedf92a
commit 27715dee20
4 changed files with 13 additions and 4 deletions
@@ -283,6 +283,7 @@ abstract class AbstractBootArchiveIntegrationTests {
void jarTypeFilteringIsApplied() throws IOException {
File flatDirRepository = new File(this.gradleBuild.getProjectDir(), "repository");
createDependenciesStarterJar(new File(flatDirRepository, "starter.jar"));
createDependenciesDeveloperToolsJar(new File(flatDirRepository, "devonly.jar"));
createStandardJar(new File(flatDirRepository, "standard.jar"));
assertThat(this.gradleBuild.build(this.taskName).task(":" + this.taskName).getOutcome())
.isEqualTo(TaskOutcome.SUCCESS);
@@ -659,6 +660,10 @@ abstract class AbstractBootArchiveIntegrationTests {
createJar(location, (attributes) -> attributes.putValue("Spring-Boot-Jar-Type", "dependencies-starter"));
}
private void createDependenciesDeveloperToolsJar(File location) throws IOException {
createJar(location, (attributes) -> attributes.putValue("Spring-Boot-Jar-Type", "development-tool"));
}
private void createJar(File location, Consumer<Attributes> attributesConfigurer) throws IOException {
location.getParentFile().mkdirs();
Manifest manifest = new Manifest();