public int main()

in daemon/src/main/java/org/apache/maven/cli/DaemonMavenCling.java [63:95]


    public int main(
            List<String> args,
            String workingDir,
            String projectDir,
            Map<String, String> env,
            BuildEventListener buildEventListener,
            InputStream in,
            OutputStream out,
            OutputStream err)
            throws Exception {
        EnvHelper.environment(workingDir, env);
        System.setProperty("maven.multiModuleProjectDirectory", projectDir);

        try {
            return invoker.invoke(parser.parseInvocation(
                    ParserRequest.builder("mvnd", "Maven Daemon", args, new DaemonMessageBuilderFactory())
                            .cwd(Paths.get(workingDir))
                            .stdIn(in)
                            .stdOut(out)
                            .stdErr(err)
                            .lookup(ProtoLookup.builder()
                                    .addMapping(Environment.class, () -> env)
                                    .addMapping(BuildEventListener.class, buildEventListener)
                                    .build())
                            .build()));
        } catch (InvokerException.ExitException e) {
            return e.getExitCode();
        } catch (Exception e) {
            // last resort; as ideally we should get ExitException only
            new SystemLogger(err).error(e.getMessage(), e);
            return 1;
        }
    }