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

[MDEP-919] Try to fix a list-repositories for Maven 4 #386

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

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