Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-7941

Meaning of -ntp CLI Option vs. --batch-mode

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 3.9.5, 4.0.0-alpha-8
    • 4.x / Backlog
    • None
    • None

    Description

      If you run a maven build while not downloaded all deps or even not downloaded any dependency at all you will see something like this on the console:

      Downloading from nexus: http://localhost:8081/nexus/content/groups/public/org/apache/apache/31/apache-31.pom
      Progress (1): 7.9/24 kB
      Progress (1): 24 kB    
      ...
      Downloading from nexus: http://localhost:8081/nexus/content/groups/public/org/eclipse/jetty/jetty-security/9.4.46.v20220331/jetty-security-9.4.46.v20220331.jar
      Progress (3): 106/733 kB | 73/225 kB | 73/184 kB
      Progress (3): 139/733 kB | 73/225 kB | 73/184 kB
      Progress (3): 139/733 kB | 106/225 kB | 73/184 kB
      Progress (3): 172/733 kB | 106/225 kB | 73/184 kB
      Progress (3): 172/733 kB | 106/225 kB | 106/184 kB
      Progress (3): 204/733 kB | 106/225 kB | 106/184 kB
      Progress (3): 204/733 kB | 139/225 kB | 106/184 kB
      Progress (3): 204/733 kB | 139/225 kB | 139/184 kB
      Progress (3): 237/733 kB | 139/225 kB | 139/184 kB
      Progress (3): 237/733 kB | 172/225 kB | 139/184 kB
      Progress (3): 237/733 kB | 172/225 kB | 172/184 kB
      Progress (3): 237/733 kB | 172/225 kB | 184 kB    
      Progress (3): 270/733 kB | 172/225 kB | 184 kB
      Progress (3): 270/733 kB | 204/225 kB | 184 kB
      Progress (3): 270/733 kB | 225 kB | 184 kB    
      Progress (4): 270/733 kB | 225 kB | 184 kB | 7.9/147 kB
      Progress (4): 303/733 kB | 225 kB | 184 kB | 7.9/147 kB
      ...                   
      

      So far as usual..

      What you can do to prevent the long outputs is just use: --batch-mode which prevents the output of the progress and the result looks like this:

      [INFO] Downloaded from nexus: http://localhost:8081/nexus/content/groups/public/org/apache/maven/doxia/doxia-module-twiki/1.11.1/doxia-module-twiki-1.11.1.jar (73 kB at 1.4 MB/s)
      [INFO] Downloading from nexus: http://localhost:8081/nexus/content/groups/public/org/eclipse/jetty/jetty-security/9.4.46.v20220331/jetty-security-9.4.46.v20220331.jar
      [INFO] Downloaded from nexus: http://localhost:8081/nexus/content/groups/public/org/eclipse/jetty/jetty-io/9.4.46.v20220331/jetty-io-9.4.46.v20220331.jar (184 kB at 3.4 MB/s)
      [INFO] Downloading from nexus: http://localhost:8081/nexus/content/groups/public/org/eclipse/jetty/jetty-util-ajax/9.4.46.v20220331/jetty-util-ajax-9.4.46.v20220331.jar
      ...
      

      So finally you can use -no-transfer-progress (or -ntp) and the output looks like this:

      [INFO] 
      [INFO] --- site:3.12.1:attach-descriptor (attach-descriptor) @ maven-dependency-plugin ---
      [INFO] Skipping because packaging 'maven-plugin' is not pom.
      [INFO] 
      [INFO] --- install:3.1.1:install (default-install) @ maven-dependency-plugin ---
      ..
      

      So based on the naming of --no-transfer-progress which is a bit misleading because the transfer progress output has already been supressed by using --batch-mode.

      For Maven 4 we could think about a more cleaner way:

      • --batch-mode will not change anything
      • --no-transfer-progress will prevent the output of Progress (3): 237/733 kB | 172/225 kB | 172/184 kB (which will really represent the function related to the name).
      • --no-download-output could suppress the output as of using -ntp in Maven 3.X

      That would be a bit more consistent

      Attachments

        Activity

          People

            Unassigned Unassigned
            khmarbaise Karl Heinz Marbaise
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: