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

The following examples show how to use org.apache.maven.artifact.Artifact#equals() . These examples are extracted from open source projects. 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
private Artifact removeNarArtifact(final Set<Artifact> artifacts) {
    final Iterator<Artifact> itr = artifacts.iterator();
    while (itr.hasNext()) {
        final Artifact artifact =;

        if (artifact.equals(project.getArtifact())) {

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

            return artifact;

    return null;
Example 2
 * 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()));