diff --git a/modules/apps/gb32960-ingest-app/pom.xml b/modules/apps/gb32960-ingest-app/pom.xml
index d9652887..d61281b5 100644
--- a/modules/apps/gb32960-ingest-app/pom.xml
+++ b/modules/apps/gb32960-ingest-app/pom.xml
@@ -66,17 +66,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- --sun-misc-unsafe-memory-access=allow
-
-
-
-
- repackage
- build-info
-
-
-
diff --git a/modules/apps/jt808-ingest-app/pom.xml b/modules/apps/jt808-ingest-app/pom.xml
index 240aa925..30ff9319 100644
--- a/modules/apps/jt808-ingest-app/pom.xml
+++ b/modules/apps/jt808-ingest-app/pom.xml
@@ -66,17 +66,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- --sun-misc-unsafe-memory-access=allow
-
-
-
-
- repackage
- build-info
-
-
-
diff --git a/modules/apps/vehicle-analytics-app/pom.xml b/modules/apps/vehicle-analytics-app/pom.xml
index 559cf965..f5668637 100644
--- a/modules/apps/vehicle-analytics-app/pom.xml
+++ b/modules/apps/vehicle-analytics-app/pom.xml
@@ -58,17 +58,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- --sun-misc-unsafe-memory-access=allow
-
-
-
-
- repackage
- build-info
-
-
-
diff --git a/modules/apps/vehicle-history-app/pom.xml b/modules/apps/vehicle-history-app/pom.xml
index 6df80520..7a9719d2 100644
--- a/modules/apps/vehicle-history-app/pom.xml
+++ b/modules/apps/vehicle-history-app/pom.xml
@@ -62,17 +62,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- --sun-misc-unsafe-memory-access=allow
-
-
-
-
- repackage
- build-info
-
-
-
diff --git a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java
index 3fce1d5b..e33f7b13 100644
--- a/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java
+++ b/modules/apps/vehicle-history-app/src/test/java/com/lingniu/ingest/historyapp/MavenModuleProfileTest.java
@@ -16,6 +16,13 @@ import static org.assertj.core.api.Assertions.assertThat;
class MavenModuleProfileTest {
+ private static final List ACTIVE_APP_POMS = List.of(
+ "modules/apps/gb32960-ingest-app/pom.xml",
+ "modules/apps/jt808-ingest-app/pom.xml",
+ "modules/apps/yutong-mqtt-app/pom.xml",
+ "modules/apps/vehicle-history-app/pom.xml",
+ "modules/apps/vehicle-analytics-app/pom.xml");
+
@Test
void commandGatewayIsOutsideDefaultProductionReactor() throws Exception {
Document pom = rootPom();
@@ -228,6 +235,34 @@ class MavenModuleProfileTest {
.isFalse();
}
+ @Test
+ void activeAppBootPackagingConfigurationIsManagedOnceInRootPom() throws Exception {
+ Document pom = rootPom();
+ Element managedBootPlugin = managedPlugin(pom, "org.springframework.boot", "spring-boot-maven-plugin");
+
+ assertThat(managedBootPlugin).isNotNull();
+ assertThat(managedBootPlugin.getTextContent())
+ .contains("${spring-boot.version}")
+ .contains("--sun-misc-unsafe-memory-access=allow")
+ .contains("repackage")
+ .contains("build-info");
+
+ for (String appPom : ACTIVE_APP_POMS) {
+ Document app = modulePom(appPom);
+ Element bootPlugin = buildPlugin(app, "org.springframework.boot", "spring-boot-maven-plugin");
+
+ assertThat(bootPlugin)
+ .as(appPom)
+ .isNotNull();
+ assertThat(firstDirectChild(bootPlugin, "configuration"))
+ .as(appPom + " should inherit shared JVM arguments from root pluginManagement")
+ .isNull();
+ assertThat(firstDirectChild(bootPlugin, "executions"))
+ .as(appPom + " should inherit repackage/build-info executions from root pluginManagement")
+ .isNull();
+ }
+ }
+
@Test
void observabilityBuildSurfaceUsesMicrometerWithoutUnusedOpenTelemetryBom() throws Exception {
Document pom = rootPom();
@@ -526,6 +561,39 @@ class MavenModuleProfileTest {
return List.copyOf(artifacts);
}
+ private static Element managedPlugin(Document pom, String groupId, String artifactId) {
+ Element build = firstDirectChild(pom.getDocumentElement(), "build");
+ Element pluginManagement = build == null ? null : firstDirectChild(build, "pluginManagement");
+ return plugin(pluginManagement, groupId, artifactId);
+ }
+
+ private static Element buildPlugin(Document pom, String groupId, String artifactId) {
+ Element build = firstDirectChild(pom.getDocumentElement(), "build");
+ return plugin(build, groupId, artifactId);
+ }
+
+ private static Element plugin(Element owner, String groupId, String artifactId) {
+ Element plugins = owner == null ? null : firstDirectChild(owner, "plugins");
+ if (plugins == null) {
+ return null;
+ }
+ NodeList children = plugins.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ if (!(children.item(i) instanceof Element plugin) || !"plugin".equals(plugin.getTagName())) {
+ continue;
+ }
+ Element currentGroupId = firstDirectChild(plugin, "groupId");
+ Element currentArtifactId = firstDirectChild(plugin, "artifactId");
+ if (currentGroupId != null
+ && currentArtifactId != null
+ && groupId.equals(currentGroupId.getTextContent().trim())
+ && artifactId.equals(currentArtifactId.getTextContent().trim())) {
+ return plugin;
+ }
+ }
+ return null;
+ }
+
private static boolean hasDependency(Document pom, String groupId, String artifactId) {
Element owner = pom.getDocumentElement();
Element dependencyManagement = firstDirectChild(owner, "dependencyManagement");
diff --git a/modules/apps/yutong-mqtt-app/pom.xml b/modules/apps/yutong-mqtt-app/pom.xml
index 6e515674..7c2039d0 100644
--- a/modules/apps/yutong-mqtt-app/pom.xml
+++ b/modules/apps/yutong-mqtt-app/pom.xml
@@ -62,17 +62,6 @@
org.springframework.boot
spring-boot-maven-plugin
-
- --sun-misc-unsafe-memory-access=allow
-
-
-
-
- repackage
- build-info
-
-
-
diff --git a/pom.xml b/pom.xml
index 4a1eb98c..787184ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -394,6 +394,17 @@
org.springframework.boot
spring-boot-maven-plugin
${spring-boot.version}
+
+ --sun-misc-unsafe-memory-access=allow
+
+
+
+
+ repackage
+ build-info
+
+
+