File tree Expand file tree Collapse file tree 4 files changed +50
-0
lines changed
main/java/org/apache/maven/shared/invoker
test/java/org/apache/maven/shared/invoker Expand file tree Collapse file tree 4 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ public class DefaultInvocationRequest
105105
106106 private int timeoutInSeconds = NO_TIMEOUT ;
107107
108+ private boolean quiet ;
109+
108110 public File getBaseDirectory ()
109111 {
110112 return basedir ;
@@ -597,4 +599,21 @@ public void setTimeoutInSeconds( int timeoutInSeconds )
597599 {
598600 this .timeoutInSeconds = timeoutInSeconds ;
599601 }
602+
603+ /**
604+ * {@inheritDoc}
605+ */
606+ public boolean isQuiet ()
607+ {
608+ return quiet ;
609+ }
610+
611+ /**
612+ * {@inheritDoc}
613+ */
614+ public InvocationRequest setQuiet ( boolean quiet )
615+ {
616+ this .quiet = quiet ;
617+ return this ;
618+ }
600619}
Original file line number Diff line number Diff line change @@ -310,6 +310,14 @@ public interface InvocationRequest
310310 */
311311 String getThreads ();
312312
313+ /**
314+ * Gets the quiet mode of the Maven invocation. By default, Maven is executed in normal mode.
315+ *
316+ * @return <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if normal mode should
317+ * be used.
318+ */
319+ boolean isQuiet ();
320+
313321 // ----------------------------------------------------------------------
314322 // Reactor Failure Mode
315323 // ----------------------------------------------------------------------
@@ -717,6 +725,15 @@ enum CheckSumPolicy
717725 */
718726 InvocationRequest setBuilder ( String id );
719727
728+ /**
729+ * Sets the quiet mode of the Maven invocation. Equivalent of {@code -q} and {@code --quiet}
730+ *
731+ * @param quiet <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if the normal mode
732+ * should be used.
733+ * @return This invocation request.
734+ */
735+ InvocationRequest setQuiet ( boolean quiet );
736+
720737 /**
721738 * Get the current set builder strategy id equivalent of {@code --builder id}. <b>Note. This is available since
722739 * Maven 3.2.1</b>
Original file line number Diff line number Diff line change @@ -501,6 +501,11 @@ else if ( CheckSumPolicy.Warn.equals( checksumPolicy ) )
501501 {
502502 cli .createArg ().setValue ( request .getBuilder () );
503503 }
504+
505+ if ( request .isQuiet () )
506+ {
507+ cli .createArg ().setValue ( "-q" );
508+ }
504509 }
505510
506511 protected void setThreads ( InvocationRequest request , Commandline cli )
Original file line number Diff line number Diff line change @@ -312,6 +312,15 @@ public void testShouldSetErrorFlagFromRequest()
312312 assertArgumentsPresent ( cli , Collections .singleton ( "-e" ) );
313313 }
314314
315+ @ Test
316+ public void testShouldSetQuietFlagFromRequest ()
317+ {
318+
319+ tcb .setFlags ( newRequest ().setQuiet ( true ), cli );
320+
321+ assertArgumentsPresent ( cli , Collections .singleton ( "-q" ));
322+ }
323+
315324 @ Test
316325 public void testDebugOptionShouldMaskShowErrorsOption ()
317326 {
You can’t perform that action at this time.
0 commit comments