Example usage for org.apache.maven RepositoryUtils toArtifacts

List of usage examples for org.apache.maven RepositoryUtils toArtifacts

Introduction

In this page you can find the example usage for org.apache.maven RepositoryUtils toArtifacts.

Prototype

public static Collection<Artifact> toArtifacts(
            Collection<org.apache.maven.artifact.Artifact> artifactsToConvert) 

Source Link

Usage

From source file:io.takari.maven.workspace.GenerationsWorkspaceReader.java

License:Apache License

private Artifact findMatchingArtifact(MavenProject project, Artifact requestedArtifact) {
    String versionlessId = ArtifactIdUtils.toVersionlessId(requestedArtifact);
    Artifact mainArtifact = RepositoryUtils.toArtifact(project.getArtifact());
    if (versionlessId.equals(ArtifactIdUtils.toVersionlessId(mainArtifact))) {
        return mainArtifact;
    }//  w ww .j  a va  2 s.c o m
    for (Artifact attachedArtifact : RepositoryUtils.toArtifacts(project.getAttachedArtifacts())) {
        if (attachedArtifactComparison(requestedArtifact, attachedArtifact)) {
            return attachedArtifact;
        }
    }
    return null;
}