-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Renaming of ArtifactCoordinate.getVersion() + documentation
#1640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
222bab3
55e7a75
1bac0e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,76 +23,88 @@ | |
| import org.apache.maven.api.annotations.Nonnull; | ||
|
|
||
| /** | ||
| * An artifact points to a resource such as a jar file or war application. | ||
| * Pointer to a resolved resource such as a <abbr>JAR</abbr> file or <abbr>WAE</abbr> application. | ||
| * Each {@code Artifact} instance is basically a pointer to a file in the Maven repository. | ||
| * {@code Artifact} instances are created when <dfn>resolving</dfn> {@link ArtifactCoordinate} instances. | ||
| * Resolving is the process that selects a {@linkplain #getVersion() particular version} | ||
| * and downloads the artifact in the local repository. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So things are a bit blurry:
During dependency collection, versions are resolved (@cstamas right?). The flattening phase removes branches of the graph so that one artifact per GA is present. The resolution phase will then download the result artifacts. We don't have any way to download an artifact for which the version has been resolved though (that may be a missing bit). So if we introduce
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added a "definitions of terms" section in |
||
| * The download may be deferred to the first time that the file is needed. | ||
| * | ||
| * @since 4.0.0 | ||
| */ | ||
| @Experimental | ||
| @Immutable | ||
| public interface Artifact { | ||
|
|
||
| /** | ||
| * Returns a unique identifier for this artifact. | ||
| * {@return a unique identifier for this artifact}. | ||
| * The identifier is composed of groupId, artifactId, extension, classifier, and version. | ||
| * | ||
| * @return the unique identifier | ||
| * @see ArtifactCoordinate#getId() | ||
| */ | ||
| @Nonnull | ||
| default String key() { | ||
| String c = getClassifier(); | ||
| return getGroupId() | ||
| + ':' | ||
| + getArtifactId() | ||
| + ':' | ||
| + getExtension() | ||
| + (getClassifier().isEmpty() ? "" : ":" + getClassifier()) | ||
| + (c.isEmpty() ? "" : ":" + c) | ||
| + ':' | ||
| + getVersion(); | ||
| } | ||
|
|
||
| /** | ||
| * The groupId of the artifact. | ||
| * {@return the group identifier of the artifact}. | ||
| * | ||
| * @return the groupId | ||
| * @see ArtifactCoordinate#getGroupId() | ||
| */ | ||
| @Nonnull | ||
| String getGroupId(); | ||
|
|
||
| /** | ||
| * The artifactId of the artifact. | ||
| * {@return the identifier of the artifact}. | ||
| * | ||
| * @return the artifactId | ||
| * @see ArtifactCoordinate#getArtifactId() | ||
| */ | ||
| @Nonnull | ||
| String getArtifactId(); | ||
|
|
||
| /** | ||
| * The version of the artifact. | ||
| * {@return the version of the artifact}. Contrarily to {@link ArtifactCoordinate}, | ||
| * each {@code Artifact} is associated to a specific version instead of a range of versions. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. range or meta version (
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then the
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I forgot that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done the removal of |
||
| * If the {@linkplain #getBaseVersion() base version} contains a meta-version such as {@code SNAPSHOT}, | ||
| * those keywords are replaced by, for example, the actual timestamp. | ||
| * | ||
| * @return the version | ||
| * @see ArtifactCoordinate#getVersionConstraint() | ||
| */ | ||
| @Nonnull | ||
| Version getVersion(); | ||
|
|
||
| /** | ||
| * The base version of the artifact. | ||
| * | ||
| * @return the version | ||
| * {@return the version or meta-version of the artifact}. | ||
| * A meta-version is a version suffixed with the {@code SNAPSHOT} keyword. | ||
| * Meta-versions are represented in a base version by their symbols (e.g., {@code SNAPSHOT}), | ||
| * while they are replaced by, for example, the actual timestamp in the {@linkplain #getVersion() version}. | ||
| */ | ||
| @Nonnull | ||
| Version getBaseVersion(); | ||
|
|
||
| /** | ||
| * The classifier of the artifact. | ||
| * Returns the classifier of the artifact. | ||
| * | ||
| * @return the classifier or an empty string if none, never {@code null} | ||
| * @see ArtifactCoordinate#getClassifier() | ||
| */ | ||
| @Nonnull | ||
| String getClassifier(); | ||
|
|
||
| /** | ||
| * The file extension of the artifact. | ||
| * Returns the file extension of the artifact. | ||
| * The dot separator is <em>not</em> included in the returned string. | ||
| * | ||
| * @return the extension | ||
| * @return the file extension or an empty string if none, never {@code null} | ||
| * @see ArtifactCoordinate#getExtension() | ||
| */ | ||
| @Nonnull | ||
| String getExtension(); | ||
|
|
@@ -106,9 +118,9 @@ default String key() { | |
| boolean isSnapshot(); | ||
|
|
||
| /** | ||
| * Shortcut for {@code session.createArtifactCoordinate(artifact)} | ||
| * {@return coordinate with the same identifiers as this artifact}. | ||
| * This is a shortcut for {@code session.createArtifactCoordinate(artifact)}. | ||
| * | ||
| * @return an {@link ArtifactCoordinate} | ||
| * @see org.apache.maven.api.Session#createArtifactCoordinate(Artifact) | ||
| */ | ||
| @Nonnull | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use
resolvedhere imho. AnArtifactmay not be resolved / downloaded.For example, the result of the
DependencyResolver#collect()method will return a graph ofNode, each one containing aDependency(which extendsArtifact), without having downloaded the related files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought that "resolved" means that all properties were fixed to their final values, especially the version and obligation. Before resolution, an
ArtifactCoordinaterefers to an ensemble of files. After resolution, anArtifactrefers to a single file. I was seeing the download as a separated concern. I have no problem in including download in the definition of "resolved", but maybe we should write this definition somewhere, e.g. in the package-info file.