From 52f6e19961e14a669eea307d6ae4bfc97e58daf6 Mon Sep 17 00:00:00 2001 From: Brett Leslie Porter Date: Wed, 9 Aug 2006 01:46:31 +0000 Subject: [PATCH] port r429917 from branch - add a quiet option for the CLI git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@429921 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/main/java/org/apache/maven/cli/CLIManager.java | 5 +++++ maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java b/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java index 9f2ed90e12..e9ddc392b7 100644 --- a/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java +++ b/maven-cli/src/main/java/org/apache/maven/cli/CLIManager.java @@ -30,6 +30,8 @@ public class CLIManager public static final char REACTOR = 'r'; + public static final char QUIET = 'q'; + public static final char DEBUG = 'X'; public static final char ERRORS = 'e'; @@ -83,6 +85,9 @@ public class CLIManager options.addOption( OptionBuilder.withLongOpt( "version" ).withDescription( "Display version information" ).create( VERSION ) ); + options.addOption( + OptionBuilder.withLongOpt( "quiet" ).withDescription( "Quiet output - only show warnings and errors" ).create( + QUIET ) ); options.addOption( OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create( DEBUG ) ); diff --git a/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java index 8586030d96..2ab966497b 100644 --- a/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java +++ b/maven-cli/src/main/java/org/apache/maven/cli/MavenCli.java @@ -170,6 +170,13 @@ public class MavenCli { recursive = false; } + else if ( commandLine.hasOption( CLIManager.QUIET ) ) + { + // TODO: we need to do some more work here. Some plugins use sys out or log errors at info level. + // Ideally, we could use Warn across the board + loggerManager.setThreshold( Logger.LEVEL_ERROR ); + // TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing. + } if ( commandLine.hasOption( CLIManager.FAIL_FAST ) ) {