class documentation

Encapsulates group, name, version and type (file extension) of an artifact as provided, for example, by a maven repository.

Basically, the pieces are used to create URLs and file names to access a repository.

Static Method fromGradleShort Create an MavenArtifact from a Gradle short form like "org.json:json:20250107" A forth element, the classifier, may be given too.
Method __init__ Creates the artifact.
Method asTarget Provides a Target which can be used to fetch the artifact and place it into the file system.
Method filename Provides the filename of the artifact.
Method repoUrl Creates the relative URL part, including filename(), which can be used to fetch the target if prefixed by a repository URL.
Instance Variable classifier artifact classifier
Instance Variable group group of the artifact
Instance Variable name name of the artifact
Instance Variable type artifact type, typically a file extension like "jar"
Instance Variable version artifact version
@staticmethod
def fromGradleShort(groupNameVersionClassifier: str, type: str) -> MavenArtifact:

Create an MavenArtifact from a Gradle short form like "org.json:json:20250107" A forth element, the classifier, may be given too.

def __init__(self, group: str, name: str, version: str, classifier: str | None, type: str):

Creates the artifact.

Parameters
group:strtypically something like "org.json"
name:strof the artifact, like "json"
version:strof the artifact, like "1.2.3"
classifier:str | Noneof the artifact, like "runtime", may be None
type:strends up as the file extension, like "jar"
def asTarget(self, dir: str, mavenRepoUrl: str | None = None, name: str | None = None) -> Target[Path]:

Provides a Target which can be used to fetch the artifact and place it into the file system.

Parameters
dir:strdirectory to copy the artifact to, also the name of the Target returned.
mavenRepoUrl:str | NoneThe URL to fetch the artifact from. If this is not provided we assume we have a local repository in ~/.m2. The string must end with '/' otherwise the resulting URL is likely wrong.
name:str | Noneoptional name for the target being created, defaults to the name of the artifact
Returns
Target[Path]the target
def filename(self) -> str:

Provides the filename of the artifact.

Returns
strfile name of the form "name-version-classifier.type" where -classifier only provided if defined in the constructor..
def repoUrl(self) -> str:

Creates the relative URL part, including filename(), which can be used to fetch the target if prefixed by a repository URL.

Returns
strURL of the form "g1/g2/.../name/version/filename" where g1,... are the dot-separated parts of the group name
classifier =

artifact classifier

group =

group of the artifact

name =

name of the artifact

type =

artifact type, typically a file extension like "jar"

version =

artifact version