diff --git a/generators/app/__snapshots__/generator.spec.ts.snap b/generators/app/__snapshots__/generator.spec.ts.snap
index 628b1479b773..e70a3c66c8bc 100644
--- a/generators/app/__snapshots__/generator.spec.ts.snap
+++ b/generators/app/__snapshots__/generator.spec.ts.snap
@@ -513,6 +513,7 @@ exports[`generator - app with default config should match snapshot 1`] = `
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
+ "jib-spring-boot-extension-maven": "'JIB-SPRING-BOOT-EXTENSION-MAVEN-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"lz4-java": "'LZ-4-JAVA-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
@@ -1129,6 +1130,7 @@ exports[`generator - app with gateway should match snapshot 1`] = `
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
+ "jib-spring-boot-extension-maven": "'JIB-SPRING-BOOT-EXTENSION-MAVEN-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"lz4-java": "'LZ-4-JAVA-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
@@ -1743,6 +1745,7 @@ exports[`generator - app with microservice should match snapshot 1`] = `
"jacoco-maven-plugin": "'JACOCO-MAVEN-PLUGIN-VERSION'",
"jhipster-dependabot": "'JHIPSTER-DEPENDABOT-VERSION'",
"jib-maven-plugin": "'JIB-MAVEN-PLUGIN-VERSION'",
+ "jib-spring-boot-extension-maven": "'JIB-SPRING-BOOT-EXTENSION-MAVEN-VERSION'",
"lifecycle-mapping": "'LIFECYCLE-MAPPING-VERSION'",
"lz4-java": "'LZ-4-JAVA-VERSION'",
"mapstruct": "'MAPSTRUCT-VERSION'",
diff --git a/generators/gradle/generators/jib/__snapshots__/generator.spec.ts.snap b/generators/gradle/generators/jib/__snapshots__/generator.spec.ts.snap
index e58a1e36a5bd..6681bbcff1e6 100644
--- a/generators/gradle/generators/jib/__snapshots__/generator.spec.ts.snap
+++ b/generators/gradle/generators/jib/__snapshots__/generator.spec.ts.snap
@@ -51,6 +51,7 @@ jib-plugin = { module = "com.google.cloud.tools:jib-gradle-plugin", version = "'
}
jib {
+ configurationName = "productionRuntimeClasspath"
from {
image = "java-jre-placeholder"
platforms {
diff --git a/generators/gradle/generators/jib/templates/buildSrc/src/main/groovy/jhipster.docker-conventions.gradle.ejs b/generators/gradle/generators/jib/templates/buildSrc/src/main/groovy/jhipster.docker-conventions.gradle.ejs
index 87530f152cb7..bd5155d6bcfb 100644
--- a/generators/gradle/generators/jib/templates/buildSrc/src/main/groovy/jhipster.docker-conventions.gradle.ejs
+++ b/generators/gradle/generators/jib/templates/buildSrc/src/main/groovy/jhipster.docker-conventions.gradle.ejs
@@ -21,6 +21,9 @@ plugins {
}
jib {
+<%_ if (backendTypeSpringBoot) { _%>
+ configurationName = "productionRuntimeClasspath"
+<%_ } _%>
from {
image = "<%- dockerContainers.javaJre %>"
platforms {
diff --git a/generators/java/generators/jib/__snapshots__/generator.spec.ts.snap b/generators/java/generators/jib/__snapshots__/generator.spec.ts.snap
index 8f46339ea545..ef3ea3eef1ac 100644
--- a/generators/java/generators/jib/__snapshots__/generator.spec.ts.snap
+++ b/generators/java/generators/jib/__snapshots__/generator.spec.ts.snap
@@ -79,7 +79,22 @@ exports[`generator - java:jib with defaults options should match source snapshot
-",
+
+
+ com.google.cloud.tools.jib.maven.extension.springboot.JibSpringBootExtension
+
+
+
+
+
+
+ com.google.cloud.tools
+ jib-spring-boot-extension-maven
+ 'JIB-SPRING-BOOT-EXTENSION-MAVEN-VERSION'
+
+
+
+",
"artifactId": "jib-maven-plugin",
"groupId": "com.google.cloud.tools",
"version": "\${jib-maven-plugin.version}",
diff --git a/generators/maven/generators/jib/generator.ts b/generators/maven/generators/jib/generator.ts
index b981e579fd68..c3cb4253cbe9 100644
--- a/generators/maven/generators/jib/generator.ts
+++ b/generators/maven/generators/jib/generator.ts
@@ -97,8 +97,31 @@ export default class JibGenerator extends BaseApplicationGenerator {
755
-
-`,
+ ${
+ application.backendTypeSpringBoot
+ ? `
+
+
+ com.google.cloud.tools.jib.maven.extension.springboot.JibSpringBootExtension
+
+
+`
+ : ''
+ }
+${
+ application.backendTypeSpringBoot
+ ? `
+
+
+ com.google.cloud.tools
+ jib-spring-boot-extension-maven
+ ${application.javaDependencies!['jib-spring-boot-extension-maven']}
+
+
+`
+ : ''
+ }
+`,
},
],
});
diff --git a/generators/server/resources/gradle/libs.versions.toml b/generators/server/resources/gradle/libs.versions.toml
index cbc71a62c48a..743c994a040c 100644
--- a/generators/server/resources/gradle/libs.versions.toml
+++ b/generators/server/resources/gradle/libs.versions.toml
@@ -16,6 +16,10 @@ neo4j-migrations-spring-boot-starter = { module = 'eu.michael-simons.neo4j:neo4j
# Cassandra
lz4-java = { module = 'org.lz4:lz4-java', version = '1.8.0' }
+# jib
+jib-maven-plugin = { module = 'com.google.cloud.tools:jib-maven-plugin', version = '3.4.3' }
+jib-spring-boot-extension-maven = { module = 'com.google.cloud.tools:jib-spring-boot-extension-maven', version = '0.1.0' }
+
[plugins]
gradle-git-properties = { id = 'com.gorylenko.gradle-git-properties', version = '2.4.2' }
diff --git a/generators/server/resources/pom.xml b/generators/server/resources/pom.xml
index 183c7b8c7a4b..c6050b788f1a 100644
--- a/generators/server/resources/pom.xml
+++ b/generators/server/resources/pom.xml
@@ -23,7 +23,6 @@
1.15.0
4.9.6
9.0.1
- 3.4.3
1.0.0
0.8.12
3.1.0
@@ -98,11 +97,6 @@
frontend-maven-plugin
${frontend-maven-plugin.version}
-
- com.google.cloud.tools
- jib-maven-plugin
- ${jib-maven-plugin.version}
-
com.puppycrawl.tools
checkstyle
diff --git a/generators/spring-boot/templates/pom.xml.ejs b/generators/spring-boot/templates/pom.xml.ejs
index 9c8f7cebedd4..ec9f3ee08971 100644
--- a/generators/spring-boot/templates/pom.xml.ejs
+++ b/generators/spring-boot/templates/pom.xml.ejs
@@ -497,6 +497,13 @@
spring-boot-maven-plugin
+ build-info
+
+ build-info
+
+
+
+ repackage
repackage
@@ -618,17 +625,6 @@
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- build-info
-
-
-
-
io.github.git-commit-id
git-commit-id-maven-plugin
@@ -778,22 +774,6 @@
e2e
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- repackage
-
- repackage
-
-
-
-
-
-
<%_ } _%>