Skip to content

Commit

Permalink
MSHARED-1418 Add support for ignore transitive repositories introduce…
Browse files Browse the repository at this point in the history
…d with Maven 3.9.7
  • Loading branch information
jonesbusy committed Jun 22, 2024
1 parent 6881f30 commit 80256aa
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public class DefaultInvocationRequest implements InvocationRequest {

private boolean noTransferProgress;

private boolean ignoreTransitiveRepositories;

private List<String> args = new ArrayList<>();

/**
Expand Down Expand Up @@ -692,6 +694,17 @@ public InvocationRequest setNoTransferProgress(boolean noTransferProgress) {
return this;
}

@Override
public boolean isIgnoreTransitiveRepositories() {
return ignoreTransitiveRepositories;
}

@Override
public InvocationRequest setIgnoreTransitiveRepositories(boolean ignoreTransitiveRepositories) {
this.ignoreTransitiveRepositories = ignoreTransitiveRepositories;
return this;
}

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

/**
* Indicates whether Maven should ignore transitive repositories. By default, transitive repositories are not
* ignored.
*
* @return <code>true</code> if transitive repositories should be ignored, <code>false</code> otherwise.
* @since 3.4.0
*/
boolean isIgnoreTransitiveRepositories();

/**
* Gets the network mode of the Maven invocation. By default, Maven is executed in online mode.
*
Expand Down Expand Up @@ -791,6 +800,15 @@ enum CheckSumPolicy {
*/
InvocationRequest setNoTransferProgress(boolean noTransferProgress);

/**
* Sets the ignore transitive repositories mode. Equivalent of {@code -itr} or {@code --ignore-transitive-repositories}
*
* @param ignoreTransitiveRepositories <code>true</code> if transitive repositories should be ignored, <code>false</code> otherwise.
* @return This invocation request.
* @since 3.4.0
*/
InvocationRequest setIgnoreTransitiveRepositories(boolean ignoreTransitiveRepositories);

/**
* 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 @@ -453,6 +453,10 @@ else if (request.isShowErrors()) {
if (request.isNoTransferProgress()) {
cli.createArg().setValue("-ntp");
}

if (request.isIgnoreTransitiveRepositories()) {
cli.createArg().setValue("-itr");
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,12 @@ void testShouldSetNoTransferProgressFlagFromRequest() {
assertArgumentsPresent(cli, Collections.singleton("-ntp"));
}

@Test
void testShouldSetIgnoreTransitiveRepositoriesFromRequest() {
mclb.setFlags(newRequest().setIgnoreTransitiveRepositories(true), cli);
assertArgumentsPresent(cli, Collections.singleton("-itr"));
}

@Test
void testShouldSpecifyFileOptionUsingNonStandardPomFileLocation() throws Exception {
File projectDir = Files.createDirectories(
Expand Down

0 comments on commit 80256aa

Please sign in to comment.