From 31e39e37739b220cd703e6fa87aa33d00f156ea3 Mon Sep 17 00:00:00 2001 From: hongwei Date: Fri, 9 Jan 2026 01:43:16 +0100 Subject: [PATCH] refactor(build): optimize JVM memory allocation and enable parallel test execution - Increase JVM heap memory from 512m to 2-4G for faster test execution - Add G1GC garbage collector and tiered compilation for improved performance - Enable parallel test execution with threadCount=4 to avoid shared state issues - Add incremental recompilation mode and Zinc server for faster builds - Increase Scala compiler JVM memory from 64m/1024m to 512m/2G - Add language feature flags to suppress compiler warnings - Add test-results directory to .gitignore for cleaner repository - Apply optimizations consistently across obp-api, obp-commons, and root pom.xml - These changes reduce build and test execution time while maintaining stability --- .gitignore | 1 + obp-api/pom.xml | 16 +++++++++++++++- obp-commons/pom.xml | 6 +++++- pom.xml | 14 ++++++++++++-- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c057cc52c..7e1e1bd93 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ project/project coursier metals.sbt obp-http4s-runner/src/main/resources/git.properties +test-results \ No newline at end of file diff --git a/obp-api/pom.xml b/obp-api/pom.xml index 7af24246b..1a05e030c 100644 --- a/obp-api/pom.xml +++ b/obp-api/pom.xml @@ -586,9 +586,13 @@ once . WDF TestSuite.txt - -Drun.mode=test -XX:MaxMetaspaceSize=512m -Xms512m -Xmx512m --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.jar=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED + + -Drun.mode=test -XX:MaxMetaspaceSize=1G -Xms2G -Xmx4G -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+UseStringDeduplication --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.jar=ALL-UNNAMED --add-opens java.base/java.security=ALL-UNNAMED code.external ${maven.test.failure.ignore} + + true + 4 @@ -667,15 +671,25 @@ 4.8.1 true + incremental + true -Xms4G -Xmx12G -XX:MaxMetaspaceSize=4G -XX:+UseG1GC + -XX:+TieredCompilation + -XX:TieredStopAtLevel=1 -deprecation -feature + + -language:implicitConversions + -language:reflectiveCalls + -language:postfixOps + + -Wconf:cat=deprecation&msg=auto-application:s diff --git a/obp-commons/pom.xml b/obp-commons/pom.xml index be3797110..de9d694ff 100644 --- a/obp-commons/pom.xml +++ b/obp-commons/pom.xml @@ -113,9 +113,13 @@ once . WDF TestSuite.txt - -Drun.mode=test -XX:MaxMetaspaceSize=512m -Xms512m -Xmx512m + + -Drun.mode=test -XX:MaxMetaspaceSize=1G -Xms2G -Xmx4G -XX:+UseG1GC -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+UseStringDeduplication code.external ${maven.test.failure.ignore} + + true + 4 diff --git a/pom.xml b/pom.xml index 082e269b9..16c10205f 100644 --- a/pom.xml +++ b/pom.xml @@ -134,10 +134,14 @@ ${scala.compiler} ${project.build.sourceEncoding} true + incremental + true -DpackageLinkDefs=file://${project.build.directory}/packageLinkDefs.properties - -Xms64m - -Xmx1024m + -Xms512m + -Xmx2G + -XX:+TieredCompilation + -XX:TieredStopAtLevel=1 -unchecked @@ -147,6 +151,12 @@ -deprecation --> -Ypartial-unification + + -language:implicitConversions + -language:reflectiveCalls + -language:postfixOps + + -Wconf:cat=deprecation&msg=auto-application:s