diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc index c74ea3d954..f9b084ce7e 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging-oci-image.adoc @@ -20,7 +20,8 @@ This goal is similar to `build-image` but does not fork the lifecycle to make su In the rest of this section, `build-image` is used to refer to either the `build-image` or `build-image-no-fork` goals. TIP: While the buildpack runs from an <>, it is not necessary to execute the `repackage` goal first as the executable archive is created automatically if necessary. -When the `build-image` repackages the application, it applies the same settings as the `repackage` goal would, that is dependencies can be excluded using one of the exclude options, and Devtools is automatically excluded by default (you can control that using the `excludeDevtools` property). +When the `build-image` repackages the application, it applies the same settings as the `repackage` goal would, that is dependencies can be excluded using one of the exclude options. +The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties). diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc index e126727095..08ec1a6c0c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/asciidoc/packaging.adoc @@ -18,8 +18,8 @@ The original (that is non-executable) artifact is renamed to `.original` by defa NOTE: The `outputFileNameMapping` feature of the `maven-war-plugin` is currently not supported. -Devtools is automatically excluded by default (you can control that using the `excludeDevtools` property). -In order to make that work with `war` packaging, the `spring-boot-devtools` dependency must be set as `optional` or with the `provided` scope. +The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties). +In order to make that work with `war` packaging, the `spring-boot-devtools` and `spring-boot-docker-compose` dependencies must be set as `optional` or with the `provided` scope. The plugin rewrites your manifest, and in particular it manages the `Main-Class` and `Start-Class` entries. If the defaults don't work you have to configure the values in the Spring Boot plugin, not in the jar plugin. diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java index 560b53cee9..4e9f322aa9 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/AbstractPackagerMojo.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2022 the original author or authors. + * Copyright 2012-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -97,6 +97,13 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo @Parameter(property = "spring-boot.repackage.excludeDevtools", defaultValue = "true") private boolean excludeDevtools = true; + /** + * Exclude Spring Boot dev services from the repackaged archive. + * @since 3.1.0 + */ + @Parameter(property = "spring-boot.repackage.excludeDockerCompose", defaultValue = "true") + private boolean excludeDockerCompose = true; + /** * Include system scoped dependencies. * @since 1.4.0 @@ -197,6 +204,13 @@ public abstract class AbstractPackagerMojo extends AbstractDependencyFilterMojo ExcludeFilter filter = new ExcludeFilter(exclude); filters.add(filter); } + if (this.excludeDockerCompose) { + Exclude exclude = new Exclude(); + exclude.setGroupId("org.springframework.boot"); + exclude.setArtifactId("spring-boot-docker-compose"); + ExcludeFilter filter = new ExcludeFilter(exclude); + filters.add(filter); + } if (!this.includeSystemScope) { filters.add(new ScopeFilter(null, Artifact.SCOPE_SYSTEM)); }