code: CliRequest createCliRequest(String[] params, String workingDirectory)
     {
        CliRequest cliRequest = null;
        try
        {
           Constructor<CliRequest> constructor = CliRequest.class.getDeclaredConstructor(String[].class,
                    ClassWorld.class);
           // This is package-private
           constructor.setAccessible(true);
           cliRequest = constructor.newInstance(params, null);
  
           Field workingDirectoryField = CliRequest.class.getDeclaredField("workingDirectory");
           workingDirectoryField.setAccessible(true);
           workingDirectoryField.set(cliRequest, workingDirectory);
  
           // This is the reason why we now call MavenCli.doMain(CliRequest)
           Field multiModuleProjectDirectoryField = CliRequest.class.getDeclaredField("multiModuleProjectDirectory");
           multiModuleProjectDirectoryField.setAccessible(true);
           multiModuleProjectDirectoryField.set(cliRequest, new File(workingDirectory));
        }
        catch (Exception e)
        {
           throw new RuntimeException("Error while creating CliRequest", e);
        }
        return cliRequest;
     }
docs: Horrible hack. Bad Maven API