Add 'excludeDockerCompose' Maven property

Update `AbstractPackagerMojo` so that the docker-compose module
can be filtered from the packaged jar.

Co-authored-by: Phillip Webb <pwebb@vmware.com>
Co-authored-by: "Andy Wilkinson <wilkinsona@vmware.com>
pull/35031/head
Mortitz Halbritter 2 years ago committed by Phillip Webb
parent 842e17eced
commit 24d1620a93

@ -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 <<packaging,executable archive>>, 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).

@ -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.

@ -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));
}

Loading…
Cancel
Save