You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2025/08/10 09:16:01 UTC

(maven) branch maven-3.9.x updated: Set Guice class loading to CHILD - avoid using terminally deprecated methods

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch maven-3.9.x
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/maven-3.9.x by this push:
     new 1f97959a11 Set Guice class loading to CHILD - avoid using terminally deprecated methods
1f97959a11 is described below

commit 1f97959a11cc4277d42da08ff581cc061849cea8
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Fri Jul 25 15:33:11 2025 +0200

    Set Guice class loading to CHILD - avoid using terminally deprecated methods
    
    Default Guice class loading uses a terminally deprecated JDK memory-access classes.
    
    Fix #10312
---
 .../src/main/java/org/apache/maven/cli/MavenCli.java          | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 18451bc43f..c7808b2455 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -271,6 +271,7 @@ public int doMain(CliRequest cliRequest) {
             initialize(cliRequest);
             cli(cliRequest);
             properties(cliRequest);
+            setupGuiceClassLoading();
             logging(cliRequest);
             informativeCommands(cliRequest);
             version(cliRequest);
@@ -475,6 +476,16 @@ private CommandLine cliMerge(CommandLine mavenConfig, CommandLine mavenCli) {
         return commandLineBuilder.build();
     }
 
+    /**
+     * Sets up Guice class loading mode to CHILD, if not already set.
+     * Default Guice class loading mode uses a terminally deprecated JDK memory-access classes.
+     */
+    void setupGuiceClassLoading() {
+        if (System.getProperty("guice_custom_class_loading", "").trim().isEmpty()) {
+            System.setProperty("guice_custom_class_loading", "CHILD");
+        }
+    }
+
     /**
      * configure logging
      */