Maven
  1. Maven
  2. MNG-4678

CLI: AbstractConsoleDownloadMonitor, BatchModeDownloadMonitor output download progress to STDOUT

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.1
    • Fix Version/s: 3.0-beta-2
    • Component/s: Command Line
    • Labels:
      None
    • Complexity:
      Intermediate
    • Number of attachments :
      0

      Description

      The code looks about like this:

      public void transferInitiated( TransferEvent transferEvent )

      { String message = transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading"; String url = transferEvent.getWagon().getRepository().getUrl(); // TODO: can't use getLogger() because this isn't currently instantiated as a component System.out.println( message + ": " + url + "/" + transferEvent.getResource().getName() ); }

      Not sure why Log instance cannot be obtained here, but this really messes up any code that would need to filter STDOUT.

        Activity

        Hide
        Benjamin Bentmann added a comment -

        What does "filter STDOUT" exactly mean? For usage in batch scenarios, one can add -batch to the Maven CLI and disable progress output. stdout is intentionally used by the CLI for the progress monitor because the logger does not support "\r".

        Show
        Benjamin Bentmann added a comment - What does "filter STDOUT" exactly mean? For usage in batch scenarios, one can add -batch to the Maven CLI and disable progress output. stdout is intentionally used by the CLI for the progress monitor because the logger does not support "\r".
        Hide
        Dimitry Voytenko added a comment -

        By filtering STDOUT I mean loading output in environment variables, etc.
        I do use "-batch" - that's why I registered this issue. Maven CLI used BatchModeDownloadMonitor in this mode, which still outputs progress into stdout:

        http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-core/src/main/java/org/apache/maven/cli/BatchModeDownloadMonitor.java

        public void transferInitiated( TransferEvent transferEvent )
        {
          String message = transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading";
        
          String url = transferEvent.getWagon().getRepository().getUrl();
        
          out.println( message + ": " + url + "/" + transferEvent.getResource().getName() );
        }
        
        Show
        Dimitry Voytenko added a comment - By filtering STDOUT I mean loading output in environment variables, etc. I do use "-batch" - that's why I registered this issue. Maven CLI used BatchModeDownloadMonitor in this mode, which still outputs progress into stdout: http://svn.apache.org/repos/asf/maven/maven-2/tags/maven-2.2.1/maven-core/src/main/java/org/apache/maven/cli/BatchModeDownloadMonitor.java public void transferInitiated( TransferEvent transferEvent ) { String message = transferEvent.getRequestType() == TransferEvent.REQUEST_PUT ? "Uploading" : "Downloading" ; String url = transferEvent.getWagon().getRepository().getUrl(); out.println( message + ": " + url + "/" + transferEvent.getResource().getName() ); }
        Hide
        Benjamin Bentmann added a comment -

        I can't quite follow, what would be the difference to your filtering if the progress went to the Logger (which eventually just prints to STDOUT) instead?

        Show
        Benjamin Bentmann added a comment - I can't quite follow, what would be the difference to your filtering if the progress went to the Logger (which eventually just prints to STDOUT) instead?
        Hide
        Dimitry Voytenko added a comment -

        I can switch off most of logger messages by running "mvn -q ...". That option does nothing to the text pushed straight into System.out, of course. Currently, "Downloading: ...." is the only thing that keeps printing from time to time to stdout.

        Show
        Dimitry Voytenko added a comment - I can switch off most of logger messages by running "mvn -q ...". That option does nothing to the text pushed straight into System.out, of course. Currently, "Downloading: ...." is the only thing that keeps printing from time to time to stdout.
        Hide
        Benjamin Bentmann added a comment -

        Aha, so what you're actually asking for is to disable the progress when quiet mode is enabled.

        Show
        Benjamin Bentmann added a comment - Aha, so what you're actually asking for is to disable the progress when quiet mode is enabled.
        Hide
        Dimitry Voytenko added a comment -

        Yes, either disable it in quite mode or batch mode - I'll adjust.

        Show
        Dimitry Voytenko added a comment - Yes, either disable it in quite mode or batch mode - I'll adjust.
        Hide
        Benjamin Bentmann added a comment -

        Made transfer progress output respect quiet mode in r947404.

        Show
        Benjamin Bentmann added a comment - Made transfer progress output respect quiet mode in r947404 .

          People

          • Assignee:
            Benjamin Bentmann
            Reporter:
            Dimitry Voytenko
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: