Skip to content

Commit

Permalink
[MDEP-919] Try to fix a list-repositories
Browse files Browse the repository at this point in the history
  • Loading branch information
slawekjaranowski committed Apr 24, 2024
1 parent 860d04b commit 8a5c043
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/it/projects/list-repositories/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ String buildLog = file.getText( "UTF-8" )
assert buildLog.contains( 'Project remote repositories used by this build:')
assert buildLog.contains( '* fake-remote-repository (http://localhost:2345, default, releases+snapshots)')
assert buildLog.contains( '* sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots, default, snapshots) mirrored by mrm-maven-plugin')
assert buildLog.contains( '* central (https://repo.maven.apache.org/maven2, default, releases) mirrored by mrm-maven-plugin')

// should I do it ...
// if (!mavenVersion.startsWith('4.')) {
assert buildLog.contains('* central (https://repo.maven.apache.org/maven2, default, releases) mirrored by mrm-maven-plugin')
//}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ protected void doExecute() throws MojoExecutionException {
@Override
public boolean visitEnter(DependencyNode node) {
repositories.addAll(node.getRepositories());
debugLogNodeRepo(node);
return true;
}

Expand Down Expand Up @@ -121,6 +122,22 @@ public boolean visitLeave(DependencyNode node) {
}
}

private void debugLogNodeRepo(DependencyNode node) {
if (!getLog().isDebugEnabled()) {
return;
}

getLog().debug("Node: " + node + " resolved from:");
node.getRepositories().forEach(repo -> {
if (repo.getMirroredRepositories().isEmpty()) {
getLog().debug(" - " + repo);
} else {
getLog().debug(" - " + repo + " as mirror for:");
repo.getMirroredRepositories().forEach(mrepo -> getLog().debug(" - " + mrepo));
}
});
}

private void prepareRemoteMirrorRepositoriesList(
StringBuilder message, Collection<RemoteRepository> remoteProjectRepositories) {

Expand Down

0 comments on commit 8a5c043

Please sign in to comment.