Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MSHARED-1018] Allow for using the -ntp ,--no-transfer-progress flag in Maven invocations #42

Merged
merged 1 commit into from Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
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
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
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