Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.

| `cleanCache`
| Whether to clean the cache before building.
|
| `spring-boot.build-image.cleanCache`
| `false`

| `verboseLogging`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ public class BuildImageMojo extends AbstractPackagerMojo {
@Parameter(property = "spring-boot.build-image.runImage", readonly = true)
String runImage;

/**
* Alias for {@link Image#cleanCache} to support configuration via command-line
* property.
* @since 2.4.0
*/
@Parameter(property = "spring-boot.build-image.cleanCache", readonly = true)
Boolean cleanCache;

/**
* Alias for {@link Image#pullPolicy} to support configuration via command-line
* property.
Expand Down Expand Up @@ -189,6 +197,9 @@ private BuildRequest getBuildRequest(Libraries libraries) throws MojoExecutionEx
if (image.runImage == null && this.runImage != null) {
image.setRunImage(this.runImage);
}
if (image.cleanCache == null && this.cleanCache != null) {
image.setCleanCache(this.cleanCache);
}
if (image.pullPolicy == null && this.pullPolicy != null) {
image.setPullPolicy(this.pullPolicy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class Image {

Map<String, String> env;

boolean cleanCache;
Boolean cleanCache;

boolean verboseLogging;

Expand Down Expand Up @@ -102,10 +102,14 @@ public Map<String, String> getEnv() {
* If the cache should be cleaned before building.
* @return {@code true} if the cache should be cleaned
*/
public boolean isCleanCache() {
public Boolean isCleanCache() {
return this.cleanCache;
}

void setCleanCache(Boolean cleanCache) {
this.cleanCache = cleanCache;
}

/**
* If verbose logging is required.
* @return {@code true} for verbose logging
Expand Down Expand Up @@ -160,7 +164,9 @@ private BuildRequest customize(BuildRequest request) {
if (this.env != null && !this.env.isEmpty()) {
request = request.withEnv(this.env);
}
request = request.withCleanCache(this.cleanCache);
if (this.cleanCache != null) {
request = request.withCleanCache(this.cleanCache);
}
request = request.withVerboseLogging(this.verboseLogging);
if (this.pullPolicy != null) {
request = request.withPullPolicy(this.pullPolicy);
Expand Down