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

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git


The following commit(s) were added to refs/heads/master by this push:
     new 4e50e954c3 Fix maven.mainClass property missing for external tools 
(#10998)
4e50e954c3 is described below

commit 4e50e954c3dcebe82185e1e1882561721e440fb6
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Mon Jul 28 09:45:35 2025 +0200

    Fix maven.mainClass property missing for external tools (#10998)
    
    Fixes #10996
    
    When external tools like IntelliJ launch Maven directly using the
    ClassWorlds launcher without setting the maven.mainClass system
    property, Maven fails with 'No such property: maven.mainClass'.
    
    This change adds a default value for maven.mainClass in m2.conf
    so that external tools can launch Maven without needing to know
    about this property. The default value is org.apache.maven.cling.MavenCling
    which is the standard Maven CLI entry point.
    
    The fix maintains backward compatibility - Maven launcher scripts
    continue to work normally by setting the property explicitly,
    while external tools now have a sensible default.
---
 apache-maven/src/assembly/maven/bin/m2.conf | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/apache-maven/src/assembly/maven/bin/m2.conf 
b/apache-maven/src/assembly/maven/bin/m2.conf
index b1df7f0934..b91431dea5 100644
--- a/apache-maven/src/assembly/maven/bin/m2.conf
+++ b/apache-maven/src/assembly/maven/bin/m2.conf
@@ -16,6 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
+set maven.mainClass default org.apache.maven.cling.MavenCling
+
 main is ${maven.mainClass} from plexus.core
 
 set maven.conf default ${maven.home}/conf

Reply via email to