Fix version display (fixes #838)
diff --git a/daemon-m39/src/main/java/org/apache/maven/cli/DaemonMavenCli.java b/daemon-m39/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
index ebc4dba..7ddc251 100644
--- a/daemon-m39/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
+++ b/daemon-m39/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
@@ -227,11 +227,11 @@
             environment(cliRequest.workingDirectory, clientEnv);
             cli(cliRequest);
             properties(cliRequest);
-            help(cliRequest);
             logging(cliRequest);
+            informativeCommands(cliRequest);
+            version(cliRequest);
             container(cliRequest);
             configure(cliRequest, eventSpyDispatcher, configurationProcessors);
-            version(cliRequest);
             toolchains(cliRequest);
             populateRequest(cliRequest);
             encryption(cliRequest);
@@ -296,11 +296,20 @@
         }
     }
 
-    private void help(CliRequest cliRequest) throws Exception {
+    private void informativeCommands(CliRequest cliRequest) throws Exception {
         if (cliRequest.commandLine.hasOption(CLIManager.HELP)) {
             buildEventListener.log(MvndHelpFormatter.displayHelp(newCLIManager()));
             throw new ExitException(0);
         }
+
+        if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
+            if (cliRequest.commandLine.hasOption(CLIManager.QUIET)) {
+                buildEventListener.log(CLIReportingUtils.showVersionMinimal());
+            } else {
+                buildEventListener.log(CLIReportingUtils.showVersion());
+            }
+            throw new ExitException(0);
+        }
     }
 
     private CLIManager newCLIManager() {
@@ -416,11 +425,8 @@
     }
 
     private void version(CliRequest cliRequest) throws ExitException {
-        if (cliRequest.debug || cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
+        if (cliRequest.debug || cliRequest.commandLine.hasOption(CLIManager.SHOW_VERSION)) {
             buildEventListener.log(CLIReportingUtils.showVersion());
-            if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
-                throw new ExitException(0);
-            }
         }
     }
 
diff --git a/daemon-m40/src/main/java/org/apache/maven/cli/DaemonMavenCli.java b/daemon-m40/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
index bda30f6..1a8f847 100644
--- a/daemon-m40/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
+++ b/daemon-m40/src/main/java/org/apache/maven/cli/DaemonMavenCli.java
@@ -216,11 +216,11 @@
             environment(cliRequest.workingDirectory, clientEnv);
             cli(cliRequest);
             properties(cliRequest);
-            help(cliRequest);
             logging(cliRequest);
+            informativeCommands(cliRequest);
+            version(cliRequest);
             container(cliRequest);
             configure(cliRequest, eventSpyDispatcher, configurationProcessors);
-            version(cliRequest);
             toolchains(cliRequest);
             populateRequest(cliRequest);
             encryption(cliRequest);
@@ -285,11 +285,20 @@
         }
     }
 
-    private void help(CliRequest cliRequest) throws Exception {
+    private void informativeCommands(CliRequest cliRequest) throws Exception {
         if (cliRequest.commandLine.hasOption(CLIManager.HELP)) {
             buildEventListener.log(MvndHelpFormatter.displayHelp(newCLIManager()));
             throw new ExitException(0);
         }
+
+        if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
+            if (cliRequest.commandLine.hasOption(CLIManager.QUIET)) {
+                buildEventListener.log(CLIReportingUtils.showVersionMinimal());
+            } else {
+                buildEventListener.log(CLIReportingUtils.showVersion());
+            }
+            throw new ExitException(0);
+        }
     }
 
     private CLIManager newCLIManager() {
@@ -400,11 +409,8 @@
     }
 
     private void version(CliRequest cliRequest) throws ExitException {
-        if (cliRequest.verbose || cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
+        if (cliRequest.verbose || cliRequest.commandLine.hasOption(CLIManager.SHOW_VERSION)) {
             buildEventListener.log(CLIReportingUtils.showVersion());
-            if (cliRequest.commandLine.hasOption(CLIManager.VERSION)) {
-                throw new ExitException(0);
-            }
         }
     }