Skip to content

Commit

Permalink
[MSHARED-1018] Allow for using the -ntp ,--no-transfer-progress flag …
Browse files Browse the repository at this point in the history
…in Maven invocations
  • Loading branch information
slawekjaranowski committed Feb 26, 2022
1 parent 2f2e123 commit 1424ed8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ public class DefaultInvocationRequest

private File mavenExecutable;

private boolean noTransferProgress;

/**
* <p>getBaseDirectory.</p>
*
Expand Down Expand Up @@ -729,6 +731,19 @@ public InvocationRequest setQuiet( boolean quiet )
return this;
}

@Override
public boolean isNoTransferProgress()
{
return noTransferProgress;
}

@Override
public InvocationRequest setNoTransferProgress( boolean noTransferProgress )
{
this.noTransferProgress = noTransferProgress;
return this;
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,14 @@ public interface InvocationRequest
*/
boolean isQuiet();

/**
* Get the value of the {@code no-transfer-progress} argument.
*
* @return {@code true} if the argument {@code no-transfer-progress} was specified, otherwise {@code false}
* @since 3.2.0
*/
boolean isNoTransferProgress();

// ----------------------------------------------------------------------
// Reactor Failure Mode
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -736,6 +744,14 @@ enum CheckSumPolicy
*/
InvocationRequest setQuiet( boolean quiet );

/**
* Enable no transfer progress mode. Equivalent of {@code -ntp} or {@code --no-transfer-progress}
* @param noTransferProgress enable no transfer progress mode
* @return This invocation request.
* @since 3.2.0
*/
InvocationRequest setNoTransferProgress( boolean noTransferProgress );

/**
* Get the current set builder strategy id equivalent of {@code --builder id}. <b>Note. This is available since
* Maven 3.2.1</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,11 @@ else if ( CheckSumPolicy.Warn.equals( checksumPolicy ) )
{
cli.createArg().setValue( "-q" );
}

if ( request.isNoTransferProgress() )
{
cli.createArg().setValue( "-ntp" );
}
}

/**
Expand Down
4 changes: 4 additions & 0 deletions src/site/apt/index.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,12 @@ ${project.name}
* Update-Snapshots Flag

* Debug Flag (show debug-level output)

* Quiet Flag (only show errors)

* Show-Errors Flag (show exception stacktraces, but not full debug output)

* No-Transfer-Progress Flag (Do not display transfer progress when downloading or uploading)

* Inherit-Shell-Environment Flag (inherit envars from the shell used to
start the current JVM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,13 @@ public void testShouldUseDefaultOfFailFastWhenSpecifiedInRequest()
assertArgumentsNotPresent( cli, banned );
}

@Test
public void testShouldSetNoTransferProgressFlagFromRequest()
{
mclb.setFlags( newRequest().setNoTransferProgress( true ), cli );
assertArgumentsPresent( cli, Collections.singleton( "-ntp" ));
}

@Test
public void testShouldSpecifyFileOptionUsingNonStandardPomFileLocation()
throws Exception
Expand Down

0 comments on commit 1424ed8

Please sign in to comment.