Class MavenArtifact


  • @Immutable
    public class MavenArtifact
    extends Artifact
    Represents a Maven software artifact with attributes such as group ID, artifact ID, version, and location. This class extends the basic Artifact by adding Maven-specific identification through group ID. It supports matching artifacts based on group ID, in addition to the properties defined in the parent class.

    Example Usage

    
     // Create a Maven artifact with group ID, artifact ID, and default version (UNKNOWN)
     MavenArtifact mavenArtifact1 = MavenArtifact.create("com.example", "my-artifact");
    
     // Create a Maven artifact with group ID, artifact ID, and specific version
     MavenArtifact mavenArtifact2 = MavenArtifact.create("com.example", "my-artifact", "1.0.0");
    
     // Create a Maven artifact with group ID, artifact ID, version, and location
     URL location = new URL("http://example.com/artifact.jar");
     MavenArtifact mavenArtifact3 = MavenArtifact.create("com.example", "my-artifact", "1.0.0", location);
    
     // Matching Maven artifacts based on group ID, artifact ID, and version
     boolean isMatch = mavenArtifact1.matches(mavenArtifact2); // returns false
      
    Since:
    1.0.0
    Author:
    Mercy
    See Also:
    Artifact, ArtifactResourceResolver