Skip to content

Commit 0613690

Browse files
desruisseauxgnodet
authored andcommitted
Update documentation according comments posted on apache#1640.
1 parent 82c9215 commit 0613690

File tree

6 files changed

+32
-12
lines changed

6 files changed

+32
-12
lines changed

api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424

2525
/**
2626
* Pointer to a resolved resource such as a <abbr>JAR</abbr> file or <abbr>WAE</abbr> application.
27-
* {@code Artifact} instances are created when <dfn>resolving</dfn> {@link Artifact} instances.
27+
* Each {@code Artifact} instance is basically a pointer to a file in the Maven repository.
28+
* {@code Artifact} instances are created when <dfn>resolving</dfn> {@link ArtifactCoordinate} instances.
2829
* Resolving is the process that selects a {@linkplain #getVersion() particular version}
2930
* and downloads the artifact in the local repository.
3031
* The download may be deferred to the first time that the file is needed.
@@ -72,15 +73,19 @@ default String key() {
7273
/**
7374
* {@return the version of the artifact}. Contrarily to {@link ArtifactCoordinate},
7475
* each {@code Artifact} is associated to a specific version instead of a range of versions.
76+
* If the {@linkplain #getBaseVersion() base version} contains a meta-version such as {@code LATEST},
77+
* {@code RELEASE} or {@code SNAPSHOT}, those keywords are replaced by, for example, the actual timestamp.
7578
*
7679
* @see ArtifactCoordinate#getVersionConstraint()
7780
*/
7881
@Nonnull
7982
Version getVersion();
8083

8184
/**
82-
* {@return the base version of the artifact}.
83-
* TODO: this javadoc is not helpful.
85+
* {@return the version or meta-version of the artifact}.
86+
* A meta-version is a version suffixed with {@code LATEST}, {@code RELEASE} or {@code SNAPSHOT} keyword.
87+
* Meta-versions are represented in a base version by their symbols (e.g., {@code SNAPSHOT}),
88+
* while they are replaced by, for example, the actual timestamp in the {@linkplain #getVersion() version}.
8489
*/
8590
@Nonnull
8691
Version getBaseVersion();

api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinate.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import org.apache.maven.api.annotations.Nonnull;
2424

2525
/**
26-
* Point to an {@link Artifact} but with the version specified as a range instead of an exact version.
26+
* Identification of an ensemble of {@code Artifact}s in a range of versions.
2727
* Each {@code ArtifactCoordinate} instance is basically a pointer to a file in the Maven repository,
2828
* except that the version may not be defined precisely.
2929
*
@@ -53,7 +53,8 @@ public interface ArtifactCoordinate {
5353
String getClassifier();
5454

5555
/**
56-
* {@return the range of versions of the artifact}.
56+
* {@return the specific version, range of versions or meta-version of the artifact}.
57+
* A meta-version is a version suffixed with {@code LATEST}, {@code RELEASE} or {@code SNAPSHOT} keyword.
5758
*/
5859
@Nonnull
5960
VersionConstraint getVersionConstraint();

api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@
2323
import org.apache.maven.api.annotations.Nonnull;
2424

2525
/**
26-
* Result of resolving a {@code DependencyCoordinate}.
27-
* Resolving is the process that clarifies the obligation (optional or mandatory status),
28-
* selects a particular version and downloads the artifact in the local repository.
26+
* A result of collecting, flattening and resolving {@code DependencyCoordinate}s.
27+
* Dependency is the output of the <dfn>collection</dfn> process, which builds the graph of dependencies,
28+
* followed by <dfn>flattening</dfn> and <dfn>resolution</dfn>.
29+
* The version selection is done for each dependency during the collection phase.
30+
* The flatten phase will keep only a single version per ({@code groupId}, {@code artifactId}) pair.
31+
* The resolution will actually download the dependencies (or artifacts) that have been computed.
2932
*
3033
* @since 4.0.0
3134
*/
@@ -53,7 +56,8 @@ public interface Dependency extends Artifact {
5356

5457
/**
5558
* Returns whether the dependency is optional or mandatory.
56-
* Contrarily to {@link DependencyCoordinate}, the obligation of a dependency cannot be unspecified.
59+
* Contrarily to {@link DependencyCoordinate}, the obligation of a {@code Dependency} is always present.
60+
* The value is computed during the dependencies collection phase.
5761
*
5862
* @return {@code true} if the dependency is optional, or {@code false} if mandatory
5963
* @see DependencyCoordinate#getOptional()

api/maven-api-core/src/main/java/org/apache/maven/api/DependencyScope.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import org.apache.maven.api.annotations.Nonnull;
2929

3030
/**
31-
* Represents at which time the dependency will be used.
32-
* If may be, for example, at compile time only, at run time or at test time.
31+
* Indicates when the dependency will be used.
32+
* For example, it may be at compile time only, at runtime, or at test time.
3333
* For a given dependency, the scope is directly derived from the
3434
* {@link org.apache.maven.api.model.Dependency#getScope()} and will be used when using {@link PathScope}
3535
* and the {@link org.apache.maven.api.services.DependencyResolver}.

api/maven-api-core/src/main/java/org/apache/maven/api/Version.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import org.apache.maven.api.annotations.Nonnull;
2323

2424
/**
25-
* A version usually parsed using the {@link org.apache.maven.api.services.VersionParser} service.
25+
* A version or meta-version of an artifact or a dependency.
26+
* A meta-version is a version suffixed with {@code LATEST}, {@code RELEASE} or {@code SNAPSHOT} keyword.
27+
* Version is usually parsed using the {@link org.apache.maven.api.services.VersionParser} service.
2628
*
2729
* @since 4.0.0
2830
* @see org.apache.maven.api.services.VersionParser#parseVersion(String)

api/maven-api-core/src/main/java/org/apache/maven/api/package-info.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@
2020
/**
2121
* Core API for Maven plugins.
2222
*
23+
* <h2>Definitions of terms</h2>
24+
* <p><dfn>Artifact resolution</dfn> is the process of {@linkplain org.apache.maven.api.services.VersionResolver
25+
* resolving the version} and then downloading the file.</p>
26+
*
27+
* <p><dfn>Dependency resolution</dfn> is the process of collecting dependencies, flattening the graph,
28+
* and then downloading the file. The flattening phase removes branches of the graph so that one artifact
29+
* per ({@code groupId}, {@code artifactId}) pair is present.</p>
30+
*
2331
* <h2>Dependency management</h2>
2432
* <p>{@link org.apache.maven.api.ArtifactCoordinate} instances are used to locate artifacts in a repository.
2533
* Each instance is basically a pointer to a file in the Maven repository, except that the version may not be

0 commit comments

Comments
 (0)