/** * Tries to resolve the specified artifact from the artifacts of the given project. * * @param project The project to try to resolve the artifact from, must not be <code>null</code>. * @param requestedArtifact The artifact to resolve, must not be <code>null</code>. * @return The matching artifact from the project or <code>null</code> if not found. */ private org.apache.maven.artifact.Artifact findMatchingArtifact( MavenProject project, Artifact requestedArtifact ) { String requestedRepositoryConflictId = getConflictId( requestedArtifact ); org.apache.maven.artifact.Artifact mainArtifact = project.getArtifact(); if ( requestedRepositoryConflictId.equals( getConflictId( mainArtifact ) ) ) { mainArtifact.setFile( new File( workspaceRoot, project.getArtifactId() ) ); return mainArtifact; } Collection<org.apache.maven.artifact.Artifact> attachedArtifacts = project.getAttachedArtifacts(); if ( attachedArtifacts != null && !attachedArtifacts.isEmpty() ) { for ( org.apache.maven.artifact.Artifact attachedArtifact : attachedArtifacts ) { if ( requestedRepositoryConflictId.equals( getConflictId( attachedArtifact ) ) ) { attachedArtifact.setFile( new File( workspaceRoot, project.getArtifactId() ) ); return attachedArtifact; } } } return null; }