Java Code Examples for org.apache.maven.artifact.Artifact#equals()

The following examples show how to use org.apache.maven.artifact.Artifact#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExtensionClassLoaderFactory.java    From nifi-maven with Apache License 2.0 6 votes vote down vote up
private Artifact removeNarArtifact(final Set<Artifact> artifacts) {
    final Iterator<Artifact> itr = artifacts.iterator();
    while (itr.hasNext()) {
        final Artifact artifact = itr.next();

        if (artifact.equals(project.getArtifact())) {
            continue;
        }

        if ("nar".equalsIgnoreCase(artifact.getType())) {
            getLog().info("Found NAR dependency of " + artifact);
            itr.remove();

            return artifact;
        }
    }

    return null;
}
 
Example 2
Source File: ReactorDependencySkipper.java    From pgpverify-maven-plugin with Apache License 2.0 3 votes vote down vote up
/**
 * Check whether the specified artifacts are equivalent, or at least
 * identify the same group, artifact ID, and version.
 *
 * @param artifact1
 *   The first artifact.
 * @param artifact2
 *   The second artifact.
 *
 * @return
 *   If either the two artifacts are equal or correspond to the same Maven
 *   coordinates.
 */
private static boolean artifactsMatch(final Artifact artifact1,
                               final Artifact artifact2) {
    return artifact1.equals(artifact2)
        || (artifact1.getGroupId().equals(artifact2.getGroupId())
            && artifact1.getArtifactId().equals(artifact2.getArtifactId())
            && artifact1.getVersion().equals(artifact2.getVersion()));
}