You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/10/07 04:38:15 UTC
(maven) branch master updated: Switch core API value types to noun-style accessors (#13036)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new b095785f3c Switch core API value types to noun-style accessors (#13036)
b095785f3c is described below
commit b095785f3cd1c4a44470641bf1683ebd5a39d551
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Oct 7 06:38:08 2026 +0200
Switch core API value types to noun-style accessors (#13036)
---
.../main/java/org/apache/maven/api/Artifact.java | 106 +++++-
.../org/apache/maven/api/ArtifactCoordinates.java | 79 ++++-
.../main/java/org/apache/maven/api/Dependency.java | 34 +-
.../apache/maven/api/DependencyCoordinates.java | 59 +++-
.../org/apache/maven/api/DownloadedArtifact.java | 12 +-
.../main/java/org/apache/maven/api/Exclusion.java | 24 +-
.../java/org/apache/maven/api/LocalRepository.java | 19 +-
.../src/main/java/org/apache/maven/api/Node.java | 75 +++-
.../main/java/org/apache/maven/api/Project.java | 377 +++++++++++++++++++--
.../org/apache/maven/api/RemoteRepository.java | 38 ++-
.../main/java/org/apache/maven/api/Repository.java | 28 +-
.../main/java/org/apache/maven/api/SourceRoot.java | 6 +-
.../org/apache/maven/api/VersionConstraint.java | 30 +-
.../java/org/apache/maven/api/VersionRange.java | 38 ++-
.../org/apache/maven/api/WorkspaceRepository.java | 2 +-
.../api/services/ArtifactCoordinatesFactory.java | 10 +-
.../ArtifactCoordinatesFactoryRequest.java | 10 +-
.../DependencyCoordinatesFactoryRequest.java | 24 +-
.../apache/maven/api/services/ProjectManager.java | 6 +-
.../apache/maven/api/ArtifactCoordinatesTest.java | 14 +-
.../java/org/apache/maven/api/SourceRootTest.java | 6 +-
.../apache/maven/internal/impl/DefaultProject.java | 68 ++--
.../impl/ConsumerPomBuilderTest.java | 2 +-
.../java/org/apache/maven/impl/AbstractNode.java | 4 +-
.../org/apache/maven/impl/AbstractSession.java | 8 +-
.../apache/maven/impl/AetherDependencyWrapper.java | 18 +-
.../org/apache/maven/impl/DefaultArtifact.java | 22 +-
.../maven/impl/DefaultArtifactCoordinates.java | 22 +-
.../org/apache/maven/impl/DefaultDependency.java | 14 +-
.../maven/impl/DefaultDependencyCoordinates.java | 10 +-
.../maven/impl/DefaultDependencyResolver.java | 6 +-
.../maven/impl/DefaultDownloadedArtifact.java | 2 +-
.../apache/maven/impl/DefaultLocalRepository.java | 6 +-
.../maven/impl/DefaultModelVersionParser.java | 12 +-
.../java/org/apache/maven/impl/DefaultNode.java | 10 +-
.../apache/maven/impl/DefaultRemoteRepository.java | 8 +-
.../maven/impl/DefaultTransportProvider.java | 2 +-
.../java/org/apache/maven/impl/WrapperNode.java | 18 +-
.../maven/impl/model/DefaultModelBuilder.java | 17 +-
.../maven/impl/DefaultArtifactCoordinatesTest.java | 4 +-
.../maven/impl/standalone/RequestTraceTest.java | 4 +-
.../maven/impl/standalone/TestApiStandalone.java | 2 +-
.../maven/testing/plugin/stubs/ArtifactStub.java | 22 +-
.../maven/testing/plugin/stubs/ProjectStub.java | 34 +-
.../maven/testing/plugin/stubs/SessionMock.java | 12 +-
45 files changed, 1033 insertions(+), 291 deletions(-)
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
index d26972c006..aaecbf0b38 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Artifact.java
@@ -29,7 +29,7 @@
*
* <p>Each {@code Artifact} instance is basically an exact pointer to a file in a Maven repository.
* {@code Artifact} instances are created when <dfn>resolving</dfn> {@link ArtifactCoordinates} instances.
- * Resolving is the process that selects a {@linkplain #getVersion() particular version}
+ * Resolving is the process that selects a {@linkplain #version() particular version}
* and downloads the artifact in the local repository. This operation returns a {@link DownloadedArtifact}.
* </p>
*
@@ -46,32 +46,61 @@ public interface Artifact {
*/
@Nonnull
default String key() {
- String c = getClassifier();
- return getGroupId()
- + ':'
- + getArtifactId()
- + ':'
- + getExtension()
- + (c.isEmpty() ? "" : ":" + c)
- + ':'
- + getVersion();
+ String c = classifier();
+ return groupId() + ':' + artifactId() + ':' + extension() + (c.isEmpty() ? "" : ":" + c) + ':' + version();
}
+ /**
+ * {@return the group identifier of the artifact}.
+ *
+ * @see ArtifactCoordinates#groupId()
+ */
+ @Nonnull
+ String groupId();
+
/**
* {@return the group identifier of the artifact}.
*
* @see ArtifactCoordinates#getGroupId()
+ * @deprecated Use {@link #groupId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getGroupId() {
+ return groupId();
+ }
+
+ /**
+ * {@return the identifier of the artifact}.
+ *
+ * @see ArtifactCoordinates#artifactId()
*/
@Nonnull
- String getGroupId();
+ String artifactId();
/**
* {@return the identifier of the artifact}.
*
* @see ArtifactCoordinates#getArtifactId()
+ * @deprecated Use {@link #artifactId()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- String getArtifactId();
+ default String getArtifactId() {
+ return artifactId();
+ }
+
+ /**
+ * {@return the version of the artifact}.
+ * Contrarily to {@link ArtifactCoordinates},
+ * each {@code Artifact} is associated to a specific version instead of a range of versions.
+ * If the {@linkplain #baseVersion() base version} contains a meta-version such as {@code SNAPSHOT},
+ * those keywords are replaced by, for example, the actual timestamp.
+ *
+ * @see ArtifactCoordinates#versionConstraint()
+ */
+ @Nonnull
+ Version version();
/**
* {@return the version of the artifact}.
@@ -81,27 +110,68 @@ default String key() {
* those keywords are replaced by, for example, the actual timestamp.
*
* @see ArtifactCoordinates#getVersionConstraint()
+ * @deprecated Use {@link #version()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Version getVersion() {
+ return 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 #version() version}.
*/
@Nonnull
- Version getVersion();
+ Version baseVersion();
/**
* {@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}.
+ *
+ * @deprecated Use {@link #baseVersion()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- Version getBaseVersion();
+ default Version getBaseVersion() {
+ return baseVersion();
+ }
+
+ /**
+ * Returns the classifier of the artifact.
+ *
+ * @return the classifier or an empty string if none, never {@code null}
+ * @see ArtifactCoordinates#classifier()
+ */
+ @Nonnull
+ String classifier();
/**
* Returns the classifier of the artifact.
*
* @return the classifier or an empty string if none, never {@code null}
* @see ArtifactCoordinates#getClassifier()
+ * @deprecated Use {@link #classifier()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getClassifier() {
+ return classifier();
+ }
+
+ /**
+ * Returns the file extension of the artifact.
+ * The dot separator is <em>not</em> included in the returned string.
+ *
+ * @return the file extension or an empty string if none, never {@code null}
+ * @see ArtifactCoordinates#extension()
*/
@Nonnull
- String getClassifier();
+ String extension();
/**
* Returns the file extension of the artifact.
@@ -109,9 +179,13 @@ default String key() {
*
* @return the file extension or an empty string if none, never {@code null}
* @see ArtifactCoordinates#getExtension()
+ * @deprecated Use {@link #extension()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- String getExtension();
+ default String getExtension() {
+ return extension();
+ }
/**
* Determines whether this artifact uses a snapshot version.
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java
index ff384d9a49..dff677b66c 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/ArtifactCoordinates.java
@@ -36,13 +36,35 @@ public interface ArtifactCoordinates {
* {@return the group identifier of the artifact}.
*/
@Nonnull
- String getGroupId();
+ String groupId();
+
+ /**
+ * {@return the group identifier of the artifact}.
+ *
+ * @deprecated Use {@link #groupId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getGroupId() {
+ return groupId();
+ }
+
+ /**
+ * {@return the identifier of the artifact}.
+ */
+ @Nonnull
+ String artifactId();
/**
* {@return the identifier of the artifact}.
+ *
+ * @deprecated Use {@link #artifactId()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- String getArtifactId();
+ default String getArtifactId() {
+ return artifactId();
+ }
/**
* Returns the classifier of the artifact.
@@ -50,14 +72,38 @@ public interface ArtifactCoordinates {
* @return the classifier or an empty string if none, never {@code null}
*/
@Nonnull
- String getClassifier();
+ String classifier();
+
+ /**
+ * Returns the classifier of the artifact.
+ *
+ * @return the classifier or an empty string if none, never {@code null}
+ * @deprecated Use {@link #classifier()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getClassifier() {
+ return classifier();
+ }
+
+ /**
+ * {@return the specific version, range of versions, or meta-version of the artifact}.
+ * A meta-version is a version suffixed with the {@code SNAPSHOT} keyword.
+ */
+ @Nonnull
+ VersionConstraint versionConstraint();
/**
* {@return the specific version, range of versions, or meta-version of the artifact}.
* A meta-version is a version suffixed with the {@code SNAPSHOT} keyword.
+ *
+ * @deprecated Use {@link #versionConstraint()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- VersionConstraint getVersionConstraint();
+ default VersionConstraint getVersionConstraint() {
+ return versionConstraint();
+ }
/**
* Returns the file extension of the artifact.
@@ -66,7 +112,20 @@ public interface ArtifactCoordinates {
* @return the file extension or an empty string if none, never {@code null}
*/
@Nonnull
- String getExtension();
+ String extension();
+
+ /**
+ * Returns the file extension of the artifact.
+ * The dot separator is <em>not</em> included in the returned string.
+ *
+ * @return the file extension or an empty string if none, never {@code null}
+ * @deprecated Use {@link #extension()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getExtension() {
+ return extension();
+ }
/**
* {@return a unique string identifying this artifact}.
@@ -78,14 +137,14 @@ public interface ArtifactCoordinates {
*/
@Nonnull
default String getId() {
- String c = getClassifier();
- return getGroupId()
+ String c = classifier();
+ return groupId()
+ ':'
- + getArtifactId()
+ + artifactId()
+ ':'
- + getExtension()
+ + extension()
+ (c.isEmpty() ? "" : ":" + c)
+ ':'
- + getVersionConstraint();
+ + versionConstraint();
}
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
index 95dc5d689e..1df90de755 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Dependency.java
@@ -35,6 +35,17 @@
@Experimental
@Immutable
public interface Dependency extends Artifact {
+ /**
+ * {@return the type of the dependency}.
+ * A dependency can be a <abbr>JAR</abbr> file,
+ * a modular-<abbr>JAR</abbr> if it is intended to be placed on the module path,
+ * a <abbr>JAR</abbr> containing test classes, <i>etc.</i>
+ *
+ * @see DependencyCoordinates#type()
+ */
+ @Nonnull
+ Type type();
+
/**
* {@return the type of the dependency}.
* A dependency can be a <abbr>JAR</abbr> file,
@@ -42,18 +53,35 @@ public interface Dependency extends Artifact {
* a <abbr>JAR</abbr> containing test classes, <i>etc.</i>
*
* @see DependencyCoordinates#getType()
+ * @deprecated Use {@link #type()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Type getType() {
+ return type();
+ }
+
+ /**
+ * {@return the time at which the dependency will be used}.
+ * It may be, for example, at compile time only, at run time or at test time.
+ *
+ * @see DependencyCoordinates#scope()
*/
@Nonnull
- Type getType();
+ DependencyScope scope();
/**
* {@return the time at which the dependency will be used}.
* It may be, for example, at compile time only, at run time or at test time.
*
* @see DependencyCoordinates#getScope()
+ * @deprecated Use {@link #scope()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- DependencyScope getScope();
+ default DependencyScope getScope() {
+ return scope();
+ }
/**
* Returns whether the dependency is optional or mandatory.
@@ -61,7 +89,7 @@ public interface Dependency extends Artifact {
* The value is computed during the dependencies collection phase.
*
* @return {@code true} if the dependency is optional, or {@code false} if mandatory
- * @see DependencyCoordinates#getOptional()
+ * @see DependencyCoordinates#optional()
*/
boolean isOptional();
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java
index cbcc264db6..cbd32fd5bc 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DependencyCoordinates.java
@@ -30,7 +30,7 @@
* This information includes the dependency type (main classes, test classes, <i>etc.</i>),
* a scope (compile, runtime <i>etc.</i>), an obligation (whether the dependency
* is optional or mandatory), and possible exclusions for transitive dependencies.
- * The {@linkplain #getVersionConstraint() version} and the {@linkplain #getOptional() obligation}
+ * The {@linkplain #versionConstraint() version} and the {@linkplain #optional() obligation}
* may not be defined precisely.
*
* @since 4.0.0
@@ -45,26 +45,75 @@ public interface DependencyCoordinates extends ArtifactCoordinates {
* a <abbr>JAR</abbr> containing test classes, a POM file, <i>etc.</i>
*/
@Nonnull
- Type getType();
+ Type type();
+
+ /**
+ * {@return the type of the dependency}
+ * A dependency can be a <abbr>JAR</abbr> file,
+ * a modular-<abbr>JAR</abbr> if it is intended to be placed on the module path,
+ * a <abbr>JAR</abbr> containing test classes, a POM file, <i>etc.</i>
+ *
+ * @deprecated Use {@link #type()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Type getType() {
+ return type();
+ }
/**
* {@return the time at which the dependency will be used}
* It may be, for example, at compile time only, at run time, or at test time.
*/
@Nonnull
- DependencyScope getScope();
+ DependencyScope scope();
+
+ /**
+ * {@return the time at which the dependency will be used}
+ * It may be, for example, at compile time only, at run time, or at test time.
+ *
+ * @deprecated Use {@link #scope()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default DependencyScope getScope() {
+ return scope();
+ }
+
+ /**
+ * Returns whether the dependency is optional, mandatory, or of unspecified obligation.
+ *
+ * @return {@code Boolean.TRUE} and {@code Boolean.FALSE} if optional, or {@code null} if unspecified
+ */
+ @Nullable
+ Boolean optional();
/**
* Returns whether the dependency is optional, mandatory, or of unspecified obligation.
*
* @return {@code Boolean.TRUE} and {@code Boolean.FALSE} if optional, or {@code null} if unspecified
+ * @deprecated Use {@link #optional()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nullable
- Boolean getOptional();
+ default Boolean getOptional() {
+ return optional();
+ }
/**
* {@return transitive dependencies to exclude}
*/
@Nonnull
- Collection<Exclusion> getExclusions();
+ Collection<Exclusion> exclusions();
+
+ /**
+ * {@return transitive dependencies to exclude}
+ *
+ * @deprecated Use {@link #exclusions()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Collection<Exclusion> getExclusions() {
+ return exclusions();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java
index f01cb2acb9..8bee4fa012 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/DownloadedArtifact.java
@@ -35,5 +35,15 @@ public interface DownloadedArtifact extends Artifact {
/**
* {@return the a path to the file that has been downloaded to the file system}.
*/
- Path getPath();
+ Path path();
+
+ /**
+ * {@return the a path to the file that has been downloaded to the file system}.
+ *
+ * @deprecated Use {@link #path()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default Path getPath() {
+ return path();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
index 99f9263c32..66b8a7f4c4 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Exclusion.java
@@ -25,13 +25,31 @@
* A dependency exclusion.
*
* @since 4.0.0
- * @see DependencyCoordinates#getExclusions()
+ * @see DependencyCoordinates#exclusions()
*/
@Experimental
public interface Exclusion {
@Nullable
- String getGroupId();
+ String groupId();
+ /**
+ * @deprecated Use {@link #groupId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nullable
- String getArtifactId();
+ default String getGroupId() {
+ return groupId();
+ }
+
+ @Nullable
+ String artifactId();
+
+ /**
+ * @deprecated Use {@link #artifactId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nullable
+ default String getArtifactId() {
+ return artifactId();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
index cea61bc3c5..0d7824d12e 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/LocalRepository.java
@@ -46,6 +46,23 @@
@Immutable
public interface LocalRepository extends Repository {
+ /**
+ * Returns the path of this local repository.
+ *
+ * @return the path, never {@code null}
+ */
@Nonnull
- Path getPath();
+ Path path();
+
+ /**
+ * Returns the path of this local repository.
+ *
+ * @return the path, never {@code null}
+ * @deprecated Use {@link #path()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Path getPath() {
+ return path();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
index 9b9b1d2efd..92aab3d6ad 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Node.java
@@ -40,39 +40,98 @@
@Provider
public interface Node {
+ /**
+ * Returns the artifact for this node.
+ *
+ * @return artifact for this node, or {@code null} if none
+ */
+ @Nullable
+ Artifact artifact();
+
+ /**
+ * Returns the dependency for this node.
+ *
+ * @return dependency for this node, or {@code null} if none
+ */
+ @Nullable
+ Dependency dependency();
+
+ /**
+ * Gets the child nodes of this node.
+ *
+ * @return the child nodes of this node, never {@code null}
+ */
+ @Nonnull
+ List<Node> children();
+
+ /**
+ * Returns the remote repositories of this node.
+ *
+ * @return repositories of this node, never {@code null}
+ */
+ @Nonnull
+ List<RemoteRepository> remoteRepositories();
+
+ /**
+ * Returns the remote repository from which this artifact was downloaded, if known.
+ *
+ * @return an {@code Optional} containing the repository, or empty if not available (e.g. local artifact or root node)
+ */
+ @Nonnull
+ Optional<RemoteRepository> repository();
+
/**
* @return artifact for this node
+ * @deprecated Use {@link #artifact()} instead.
*/
@Nullable
- Artifact getArtifact();
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default Artifact getArtifact() {
+ return artifact();
+ }
/**
* @return dependency for this node
+ * @deprecated Use {@link #dependency()} instead.
*/
@Nullable
- Dependency getDependency();
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default Dependency getDependency() {
+ return dependency();
+ }
/**
* Gets the child nodes of this node.
*
* @return the child nodes of this node, never {@code null}
+ * @deprecated Use {@link #children()} instead.
*/
@Nonnull
- List<Node> getChildren();
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default List<Node> getChildren() {
+ return children();
+ }
/**
* @return repositories of this node
+ * @deprecated Use {@link #remoteRepositories()} instead.
*/
@Nonnull
- List<RemoteRepository> getRemoteRepositories();
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default List<RemoteRepository> getRemoteRepositories() {
+ return remoteRepositories();
+ }
/**
- * Returns the remote repository from which this artifact was downloaded, if known.
+ * The repository where this artifact has been downloaded from.
*
- * @return an {@code Optional} containing the repository, or empty if not available (e.g. local artifact or root node)
+ * @deprecated Use {@link #repository()} instead.
*/
@Nonnull
- Optional<RemoteRepository> getRepository();
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default Optional<RemoteRepository> getRepository() {
+ return repository();
+ }
/**
* Traverses this node and potentially its children using the specified visitor.
@@ -124,6 +183,6 @@ public interface Node {
*/
@Nonnull
default Stream<Node> stream() {
- return Stream.concat(Stream.of(this), getChildren().stream().flatMap(Node::stream));
+ return Stream.concat(Stream.of(this), children().stream().flatMap(Node::stream));
}
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
index 22115c3572..5dc72df8ee 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Project.java
@@ -38,8 +38,8 @@
* <p>
* Projects are created using the {@code ProjectBuilder} from a POM file
* (usually named {@code pom.xml}) on the file system.
- * The {@link #getPomPath()} will point to the POM file and the
- * {@link #getBasedir()} to the directory parent containing the
+ * The {@link #pomPath()} will point to the POM file and the
+ * {@link #basedir()} to the directory parent containing the
* POM file.
* </p>
*
@@ -54,19 +54,64 @@ public interface Project {
* {@return the project groupId}.
*/
@Nonnull
- String getGroupId();
+ String groupId();
+
+ /**
+ * {@return the project groupId}.
+ *
+ * @deprecated Use {@link #groupId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getGroupId() {
+ return groupId();
+ }
/**
* {@return the project artifactId}.
*/
@Nonnull
- String getArtifactId();
+ String artifactId();
+
+ /**
+ * {@return the project artifactId}.
+ *
+ * @deprecated Use {@link #artifactId()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default String getArtifactId() {
+ return artifactId();
+ }
+
+ /**
+ * {@return the project version}.
+ */
+ @Nonnull
+ String version();
/**
* {@return the project version}.
+ *
+ * @deprecated Use {@link #version()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- String getVersion();
+ default String getVersion() {
+ return version();
+ }
+
+ /**
+ * {@return the project packaging}.
+ * <p>
+ * Note: unlike in legacy code, logical checks against string representing packaging (returned by this method)
+ * are NOT recommended (code like {@code "pom".equals(project.getPackaging)} must be avoided). Use method
+ * {@link #artifacts()} to gain access to POM or build artifact.
+ *
+ * @see #artifacts()
+ */
+ @Nonnull
+ Packaging packaging();
/**
* {@return the project packaging}.
@@ -76,18 +121,34 @@ public interface Project {
* {@link #getArtifacts()} to gain access to POM or build artifact.
*
* @see #getArtifacts()
+ * @deprecated Use {@link #packaging()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Packaging getPackaging() {
+ return packaging();
+ }
+
+ /**
+ * {@return the project language}. It is by default determined by {@link #packaging()}.
+ *
+ * @see #packaging()
*/
@Nonnull
- Packaging getPackaging();
+ default Language language() {
+ return packaging().language();
+ }
/**
* {@return the project language}. It is by default determined by {@link #getPackaging()}.
*
* @see #getPackaging()
+ * @deprecated Use {@link #language()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
default Language getLanguage() {
- return getPackaging().language();
+ return language();
}
/**
@@ -97,8 +158,34 @@ default Language getLanguage() {
* @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
*/
@Nonnull
+ default ProducedArtifact pomArtifact() {
+ return artifacts().get(0);
+ }
+
+ /**
+ * {@return the project POM artifact}, which is the artifact of the POM of this project. Every project have a POM
+ * artifact, even if the existence of backing POM file is NOT a requirement (i.e. for some transient projects).
+ *
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ * @deprecated Use {@link #pomArtifact()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
default ProducedArtifact getPomArtifact() {
- return getArtifacts().get(0);
+ return pomArtifact();
+ }
+
+ /**
+ * {@return the project main artifact}, which is the artifact produced by this project build, if applicable.
+ * This artifact MAY be absent if the project is actually not producing any main artifact (i.e. "pom" packaging).
+ *
+ * @see #packaging()
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ default Optional<ProducedArtifact> mainArtifact() {
+ List<ProducedArtifact> artifacts = artifacts();
+ return artifacts.size() == 2 ? Optional.of(artifacts.get(1)) : Optional.empty();
}
/**
@@ -107,13 +194,30 @@ default ProducedArtifact getPomArtifact() {
*
* @see #getPackaging()
* @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ * @deprecated Use {@link #mainArtifact()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
default Optional<ProducedArtifact> getMainArtifact() {
- List<ProducedArtifact> artifacts = getArtifacts();
- return artifacts.size() == 2 ? Optional.of(artifacts.get(1)) : Optional.empty();
+ return mainArtifact();
}
+ /**
+ * {@return the project artifacts as immutable list}. Elements are the project POM artifact and the artifact
+ * produced by this project build, if applicable. Hence, the returned list may have one or two elements
+ * (never less than 1, never more than 2), depending on project packaging.
+ * <p>
+ * The list's first element is ALWAYS the project POM artifact. Presence of second element in the list depends
+ * solely on the project packaging.
+ *
+ * @see #packaging()
+ * @see #pomArtifact()
+ * @see #mainArtifact()
+ * @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ */
+ @Nonnull
+ List<ProducedArtifact> artifacts();
+
/**
* {@return the project artifacts as immutable list}. Elements are the project POM artifact and the artifact
* produced by this project build, if applicable. Hence, the returned list may have one or two elements
@@ -126,15 +230,30 @@ default Optional<ProducedArtifact> getMainArtifact() {
* @see #getPomArtifact()
* @see #getMainArtifact()
* @see org.apache.maven.api.services.ArtifactManager#getPath(Artifact)
+ * @deprecated Use {@link #artifacts()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- List<ProducedArtifact> getArtifacts();
+ default List<ProducedArtifact> getArtifacts() {
+ return artifacts();
+ }
/**
* {@return the project model}.
*/
@Nonnull
- Model getModel();
+ Model model();
+
+ /**
+ * {@return the project model}.
+ *
+ * @deprecated Use {@link #model()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Model getModel() {
+ return model();
+ }
/**
* Shorthand method.
@@ -142,11 +261,39 @@ default Optional<ProducedArtifact> getMainArtifact() {
* @return the build element of the project model
*/
@Nonnull
- default Build getBuild() {
- Build build = getModel().getBuild();
+ default Build build() {
+ Build build = model().getBuild();
return build != null ? build : Build.newInstance();
}
+ /**
+ * Shorthand method.
+ *
+ * @return the build element of the project model
+ * @deprecated Use {@link #build()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Build getBuild() {
+ return build();
+ }
+
+ /**
+ * Returns the path to the pom file for this project.
+ * A project is usually read from a file named {@code pom.xml},
+ * which contains the {@linkplain #model() model} in an XML form.
+ * When a custom {@code org.apache.maven.api.spi.ModelParser} is used,
+ * the path may point to a non XML file.
+ * <p>
+ * The POM path is also used to define the {@linkplain #basedir() base directory}
+ * of the project.
+ *
+ * @return the path of the pom
+ * @see #basedir()
+ */
+ @Nonnull
+ Path pomPath();
+
/**
* Returns the path to the pom file for this project.
* A project is usually read from a file named {@code pom.xml},
@@ -159,9 +306,13 @@ default Build getBuild() {
*
* @return the path of the pom
* @see #getBasedir()
+ * @deprecated Use {@link #pomPath()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- Path getPomPath();
+ default Path getPomPath() {
+ return pomPath();
+ }
/**
* Returns the project base directory, i.e. the directory containing the project.
@@ -171,7 +322,21 @@ default Build getBuild() {
* @return the path of the directory containing the project
*/
@Nonnull
- Path getBasedir();
+ Path basedir();
+
+ /**
+ * Returns the project base directory, i.e. the directory containing the project.
+ * A project is usually read from the file system and this will point to
+ * the directory containing the POM file.
+ *
+ * @return the path of the directory containing the project
+ * @deprecated Use {@link #basedir()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Path getBasedir() {
+ return basedir();
+ }
/**
* {@return the absolute path to the directory where files generated by the build are placed}
@@ -257,15 +422,15 @@ default Build getBuild() {
* Project project = ...; // project at /home/user/myproject
*
* // Get main output directory
- * Path mainOutput = project.getOutputDirectory(ProjectScope.MAIN);
+ * Path mainOutput = project.outputDirectory(ProjectScope.MAIN);
* // Result: /home/user/myproject/target/classes
*
* // Get test output directory
- * Path testOutput = project.getOutputDirectory(ProjectScope.TEST);
+ * Path testOutput = project.outputDirectory(ProjectScope.TEST);
* // Result: /home/user/myproject/target/test-classes
*
* // Get build directory
- * Path buildDir = project.getOutputDirectory(null);
+ * Path buildDir = project.outputDirectory(null);
* // Result: /home/user/myproject/target
* }</pre>
*
@@ -279,9 +444,9 @@ default Build getBuild() {
* @see Build#getDirectory()
*/
@Nonnull
- default Path getOutputDirectory(@Nullable ProjectScope scope) {
+ default Path outputDirectory(@Nullable ProjectScope scope) {
String dir;
- Build build = getBuild();
+ Build build = build();
if (scope == ProjectScope.MAIN) {
dir = build.getOutputDirectory();
} else if (scope == ProjectScope.TEST) {
@@ -289,27 +454,62 @@ default Path getOutputDirectory(@Nullable ProjectScope scope) {
} else {
dir = build.getDirectory();
}
- return getBasedir().resolve(dir);
+ return basedir().resolve(dir);
+ }
+
+ /**
+ * {@return the absolute path to the directory where files generated by the build are placed}
+ *
+ * @param scope the scope of the generated files for which to get the directory, or {@code null} for the build directory
+ * @return the absolute path to the output directory for the given scope
+ * @deprecated Use {@link #outputDirectory(ProjectScope)} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Path getOutputDirectory(@Nullable ProjectScope scope) {
+ return outputDirectory(scope);
}
/**
* {@return the project direct dependencies (directly specified or inherited)}.
*/
@Nonnull
- List<DependencyCoordinates> getDependencies();
+ List<DependencyCoordinates> dependencies();
+
+ /**
+ * {@return the project direct dependencies (directly specified or inherited)}.
+ *
+ * @deprecated Use {@link #dependencies()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default List<DependencyCoordinates> getDependencies() {
+ return dependencies();
+ }
+
+ /**
+ * {@return the project managed dependencies (directly specified or inherited)}.
+ */
+ @Nonnull
+ List<DependencyCoordinates> managedDependencies();
/**
* {@return the project managed dependencies (directly specified or inherited)}.
+ *
+ * @deprecated Use {@link #managedDependencies()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- List<DependencyCoordinates> getManagedDependencies();
+ default List<DependencyCoordinates> getManagedDependencies() {
+ return managedDependencies();
+ }
/**
* {@return the project ID, usable as key}.
*/
@Nonnull
default String getId() {
- return getModel().getId();
+ return model().getId();
}
/**
@@ -325,7 +525,7 @@ default String getId() {
/**
* Returns a boolean indicating if the project is a root project,
- * meaning that the {@link #getRootDirectory()} and {@link #getBasedir()}
+ * meaning that the {@link #rootDirectory()} and {@link #basedir()}
* points to the same directory, and that either {@link Model#isRoot()}
* is {@code true} or that {@code basedir} contains a {@code .mvn} child
* directory.
@@ -344,7 +544,22 @@ default String getId() {
* @see Session#getRootDirectory()
*/
@Nonnull
- Path getRootDirectory();
+ Path rootDirectory();
+
+ /**
+ * Gets the root directory of the project, which is the parent directory
+ * containing the {@code .mvn} directory or flagged with {@code root="true"}.
+ *
+ * @return the root directory of the project
+ * @throws IllegalStateException if the root directory could not be found
+ * @see Session#getRootDirectory()
+ * @deprecated Use {@link #rootDirectory()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Path getRootDirectory() {
+ return rootDirectory();
+ }
/**
* Returns project parent project, if any.
@@ -357,7 +572,37 @@ default String getId() {
* @see Model#getParent()
*/
@Nonnull
- Optional<Project> getParent();
+ Optional<Project> parent();
+
+ /**
+ * Returns project parent project, if any.
+ * <p>
+ * Note that the model may have a parent defined, but an empty parent
+ * project may be returned if the parent comes from a remote repository,
+ * as a {@code Project} must refer to a buildable project.
+ *
+ * @return an optional containing the parent project
+ * @see Model#getParent()
+ * @deprecated Use {@link #parent()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default Optional<Project> getParent() {
+ return parent();
+ }
+
+ /**
+ * Returns all profiles defined in this project.
+ * <p>
+ * This method returns only the profiles defined directly in the current project's POM
+ * and does not include profiles from parent projects.
+ *
+ * @return a non-null, possibly empty list of profiles defined in this project
+ * @see Profile
+ * @see #effectiveProfiles()
+ */
+ @Nonnull
+ List<Profile> declaredProfiles();
/**
* Returns all profiles defined in this project.
@@ -368,9 +613,27 @@ default String getId() {
* @return a non-null, possibly empty list of profiles defined in this project
* @see Profile
* @see #getEffectiveProfiles()
+ * @deprecated Use {@link #declaredProfiles()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nonnull
+ default List<Profile> getDeclaredProfiles() {
+ return declaredProfiles();
+ }
+
+ /**
+ * Returns all profiles defined in this project and all of its parent projects.
+ * <p>
+ * This method traverses the parent hierarchy and includes profiles defined in parent POMs.
+ * The returned list contains profiles from the current project and all of its ancestors in
+ * the project inheritance chain.
+ *
+ * @return a non-null, possibly empty list of all profiles from this project and its parents
+ * @see Profile
+ * @see #declaredProfiles()
*/
@Nonnull
- List<Profile> getDeclaredProfiles();
+ List<Profile> effectiveProfiles();
/**
* Returns all profiles defined in this project and all of its parent projects.
@@ -382,9 +645,34 @@ default String getId() {
* @return a non-null, possibly empty list of all profiles from this project and its parents
* @see Profile
* @see #getDeclaredProfiles()
+ * @deprecated Use {@link #effectiveProfiles()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- List<Profile> getEffectiveProfiles();
+ default List<Profile> getEffectiveProfiles() {
+ return effectiveProfiles();
+ }
+
+ /**
+ * Returns all active profiles for the current project build.
+ * <p>
+ * Active profiles are those that have been explicitly activated through one of the following means:
+ * <ul>
+ * <li>Command line activation using the -P flag</li>
+ * <li>Maven settings activation in settings.xml via <activeProfiles></li>
+ * <li>Automatic activation via <activation> conditions</li>
+ * <li>The default active profile (marked with <activeByDefault>true</activeByDefault>)</li>
+ * </ul>
+ * <p>
+ * The active profiles control various aspects of the build configuration including but not
+ * limited to dependencies, plugins, properties, and build resources.
+ *
+ * @return a non-null, possibly empty list of active profiles for this project
+ * @see Profile
+ * @see #effectiveActiveProfiles()
+ */
+ @Nonnull
+ List<Profile> declaredActiveProfiles();
/**
* Returns all active profiles for the current project build.
@@ -403,9 +691,30 @@ default String getId() {
* @return a non-null, possibly empty list of active profiles for this project
* @see Profile
* @see #getEffectiveActiveProfiles()
+ * @deprecated Use {@link #declaredActiveProfiles()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- List<Profile> getDeclaredActiveProfiles();
+ default List<Profile> getDeclaredActiveProfiles() {
+ return declaredActiveProfiles();
+ }
+
+ /**
+ * Returns all active profiles for this project and all of its parent projects.
+ * <p>
+ * This method traverses the parent hierarchy and collects all active profiles from
+ * the current project and its ancestors. Active profiles are those that meet the
+ * activation criteria through explicit activation or automatic conditions.
+ * <p>
+ * The combined set of active profiles from the entire project hierarchy affects
+ * the effective build configuration.
+ *
+ * @return a non-null, possibly empty list of all active profiles from this project and its parents
+ * @see Profile
+ * @see #declaredActiveProfiles()
+ */
+ @Nonnull
+ List<Profile> effectiveActiveProfiles();
/**
* Returns all active profiles for this project and all of its parent projects.
@@ -420,7 +729,11 @@ default String getId() {
* @return a non-null, possibly empty list of all active profiles from this project and its parents
* @see Profile
* @see #getDeclaredActiveProfiles()
+ * @deprecated Use {@link #effectiveActiveProfiles()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nonnull
- List<Profile> getEffectiveActiveProfiles();
+ default List<Profile> getEffectiveActiveProfiles() {
+ return effectiveActiveProfiles();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
index a2fea88a19..2b8d29b412 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/RemoteRepository.java
@@ -56,9 +56,43 @@
@Immutable
public interface RemoteRepository extends Repository {
+ /**
+ * Returns the URL of this remote repository.
+ *
+ * @return the URL, never {@code null}
+ */
@Nonnull
- String getUrl();
+ String url();
+ /**
+ * Returns the protocol of this remote repository.
+ *
+ * @return the protocol, never {@code null}
+ */
@Nonnull
- String getProtocol();
+ String protocol();
+
+ /**
+ * Returns the URL of this remote repository.
+ *
+ * @return the URL, never {@code null}
+ * @deprecated Use {@link #url()} instead.
+ */
+ @Nonnull
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default String getUrl() {
+ return url();
+ }
+
+ /**
+ * Returns the protocol of this remote repository.
+ *
+ * @return the protocol, never {@code null}
+ * @deprecated Use {@link #protocol()} instead.
+ */
+ @Nonnull
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default String getProtocol() {
+ return protocol();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
index 82c5a1b1c4..5de3c3d152 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Repository.java
@@ -64,7 +64,7 @@ public interface Repository {
* @return the (case-sensitive) identifier, never {@code null}
*/
@Nonnull
- String getId();
+ String id();
/**
* Gets the type of the repository, for example "default".
@@ -72,5 +72,29 @@ public interface Repository {
* @return the (case-sensitive) type of the repository, never {@code null}
*/
@Nonnull
- String getType();
+ String type();
+
+ /**
+ * Gets the identifier of this repository.
+ *
+ * @return the (case-sensitive) identifier, never {@code null}
+ * @deprecated Use {@link #id()} instead.
+ */
+ @Nonnull
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default String getId() {
+ return id();
+ }
+
+ /**
+ * Gets the type of the repository, for example "default".
+ *
+ * @return the (case-sensitive) type of the repository, never {@code null}
+ * @deprecated Use {@link #type()} instead.
+ */
+ @Nonnull
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default String getType() {
+ return type();
+ }
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java b/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
index 5d34998c8f..57a04f60e6 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/SourceRoot.java
@@ -215,7 +215,7 @@ default Optional<Path> targetPath() {
* <li>If the configured target path is absolute (e.g., {@code /tmp/custom}):
* <ul><li>Return it unchanged (no resolution needed)</li></ul></li>
* <li>Otherwise, get the output directory for this source root's {@link #scope()} by calling
- * {@code project.getOutputDirectory(scope())}:
+ * {@code project.outputDirectory(scope())}:
* <ul>
* <li>For {@link ProjectScope#MAIN}: typically {@code /path/to/project/target/classes}</li>
* <li>For {@link ProjectScope#TEST}: typically {@code /path/to/project/target/test-classes}</li>
@@ -289,7 +289,7 @@ default Optional<Path> targetPath() {
* if (configured.isPresent() && configured.get().isAbsolute()) {
* return configured.get();
* }
- * Path outputDir = project.getOutputDirectory(scope());
+ * Path outputDir = project.outputDirectory(scope());
* return configured.map(outputDir::resolve).orElse(outputDir);
* }</pre>
*
@@ -304,7 +304,7 @@ default Path targetPath(@Nonnull Project project) {
Optional<Path> targetPath = targetPath();
// The test for `isAbsolute()` is a small optimization for avoiding the call to `getOutputDirectory(…)`.
return targetPath.filter(Path::isAbsolute).orElseGet(() -> {
- Path base = project.getOutputDirectory(scope());
+ Path base = project.outputDirectory(scope());
return targetPath.map(base::resolve).orElse(base);
});
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java
index 5d5ac0fc4f..4c896019c0 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionConstraint.java
@@ -37,21 +37,47 @@
*/
@Experimental
public interface VersionConstraint {
+ /**
+ * Returns the range of this constraint, or {@code null} if none.
+ * <p>
+ * Note: only one, this method or {@link #recommendedVersion()} method must return non-{@code null} value.
+ */
+ @Nullable
+ VersionRange versionRange();
+
/**
* Returns the range of this constraint, or {@code null} if none.
* <p>
* Note: only one, this method or {@link #getRecommendedVersion()} method must return non-{@code null} value.
+ *
+ * @deprecated Use {@link #versionRange()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nullable
- VersionRange getVersionRange();
+ default VersionRange getVersionRange() {
+ return versionRange();
+ }
+
+ /**
+ * Returns the recommended version of this constraint, or {@code null} if none.
+ * <p>
+ * Note: only one, this method or {@link #versionRange()} method must return non-{@code null} value.
+ */
+ @Nullable
+ Version recommendedVersion();
/**
* Returns the recommended version of this constraint, or {@code null} if none.
* <p>
* Note: only one, this method or {@link #getVersionRange()} method must return non-{@code null} value.
+ *
+ * @deprecated Use {@link #recommendedVersion()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nullable
- Version getRecommendedVersion();
+ default Version getRecommendedVersion() {
+ return recommendedVersion();
+ }
/**
* Determines whether the specified version is contained within this constraint.
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
index 224b5d6f75..056a79bebe 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/VersionRange.java
@@ -48,13 +48,35 @@ public interface VersionRange {
* Returns the upper boundary of this range, or {@code null} if none.
*/
@Nullable
- Boundary getUpperBoundary();
+ Boundary upperBoundary();
+
+ /**
+ * Returns the upper boundary of this range, or {@code null} if none.
+ *
+ * @deprecated Use {@link #upperBoundary()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ @Nullable
+ default Boundary getUpperBoundary() {
+ return upperBoundary();
+ }
+
+ /**
+ * Returns the lower boundary of this range, or {@code null} if none.
+ */
+ @Nullable
+ Boundary lowerBoundary();
/**
* Returns the lower boundary of this range, or {@code null} if none.
+ *
+ * @deprecated Use {@link #lowerBoundary()} instead.
*/
+ @Deprecated(since = "4.1.0", forRemoval = true)
@Nullable
- Boundary getLowerBoundary();
+ default Boundary getLowerBoundary() {
+ return lowerBoundary();
+ }
/**
* {@return the string representation of this version}
@@ -70,7 +92,17 @@ interface Boundary {
/**
* The bounding version.
*/
- Version getVersion();
+ Version version();
+
+ /**
+ * The bounding version.
+ *
+ * @deprecated Use {@link #version()} instead.
+ */
+ @Deprecated(since = "4.1.0", forRemoval = true)
+ default Version getVersion() {
+ return version();
+ }
/**
* Returns {@code true} if version is included of the range.
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java b/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java
index f8cd2bac6d..6c5db8b998 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/WorkspaceRepository.java
@@ -34,7 +34,7 @@ public interface WorkspaceRepository extends Repository {
*/
@Nonnull
@Override
- default String getType() {
+ default String type() {
return "workspace";
}
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java
index 50fa35c04c..8dce1ed48f 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactory.java
@@ -80,11 +80,11 @@ default ArtifactCoordinates create(
default ArtifactCoordinates create(@Nonnull Session session, Artifact artifact) {
return create(ArtifactCoordinatesFactoryRequest.build(
session,
- artifact.getGroupId(),
- artifact.getArtifactId(),
- artifact.getVersion().toString(),
- artifact.getClassifier(),
- artifact.getExtension(),
+ artifact.groupId(),
+ artifact.artifactId(),
+ artifact.version().toString(),
+ artifact.classifier(),
+ artifact.extension(),
null));
}
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java
index d2c3540f3c..0c7ae82767 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactCoordinatesFactoryRequest.java
@@ -96,11 +96,11 @@ static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnul
static ArtifactCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull ArtifactCoordinates coordinates) {
return ArtifactCoordinatesFactoryRequest.builder()
.session(requireNonNull(session, "session"))
- .groupId(requireNonNull(coordinates, "coordinates").getGroupId())
- .artifactId(coordinates.getArtifactId())
- .classifier(coordinates.getClassifier())
- .version(coordinates.getVersionConstraint().toString())
- .extension(coordinates.getExtension())
+ .groupId(requireNonNull(coordinates, "coordinates").groupId())
+ .artifactId(coordinates.artifactId())
+ .classifier(coordinates.classifier())
+ .version(coordinates.versionConstraint().toString())
+ .extension(coordinates.extension())
.build();
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java
index c0314b2078..70d4d02f52 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/DependencyCoordinatesFactoryRequest.java
@@ -76,11 +76,11 @@ static DependencyCoordinatesFactoryRequest build(
return builder()
.session(requireNonNull(session, "session cannot be null"))
.groupId(requireNonNull(coordinates, "coordinates cannot be null")
- .getGroupId())
- .artifactId(coordinates.getArtifactId())
- .version(coordinates.getVersionConstraint().toString())
- .classifier(coordinates.getClassifier())
- .extension(coordinates.getExtension())
+ .groupId())
+ .artifactId(coordinates.artifactId())
+ .version(coordinates.versionConstraint().toString())
+ .classifier(coordinates.classifier())
+ .extension(coordinates.extension())
.build();
}
@@ -88,13 +88,13 @@ static DependencyCoordinatesFactoryRequest build(
static DependencyCoordinatesFactoryRequest build(@Nonnull Session session, @Nonnull Dependency dependency) {
return builder()
.session(requireNonNull(session, "session cannot be null"))
- .groupId(requireNonNull(dependency, "dependency").getGroupId())
- .artifactId(dependency.getArtifactId())
- .version(dependency.getVersion().toString())
- .classifier(dependency.getClassifier())
- .extension(dependency.getExtension())
- .type(dependency.getType().id())
- .scope(dependency.getScope().id())
+ .groupId(requireNonNull(dependency, "dependency").groupId())
+ .artifactId(dependency.artifactId())
+ .version(dependency.version().toString())
+ .classifier(dependency.classifier())
+ .extension(dependency.extension())
+ .type(dependency.type().id())
+ .scope(dependency.scope().id())
.optional(dependency.isOptional())
.build();
}
diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectManager.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectManager.java
index 8609c3e7ee..6777850d8b 100644
--- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectManager.java
+++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ProjectManager.java
@@ -120,8 +120,8 @@ default void attachArtifact(@Nonnull Session session, @Nonnull Project project,
String name = path.getFileName().toString();
int dot = name.lastIndexOf('.');
String ext = dot >= 1 ? name.substring(dot + 1) : "";
- ProducedArtifact artifact = session.createProducedArtifact(
- project.getGroupId(), project.getArtifactId(), project.getVersion(), ext);
+ ProducedArtifact artifact =
+ session.createProducedArtifact(project.groupId(), project.artifactId(), project.version(), ext);
attachArtifact(project, artifact, path);
}
@@ -137,7 +137,7 @@ default void attachArtifact(@Nonnull Session session, @Nonnull Project project,
default void attachArtifact(
@Nonnull Session session, @Nonnull Project project, @Nonnull String type, @Nonnull Path path) {
ProducedArtifact artifact = session.createProducedArtifact(
- project.getGroupId(), project.getArtifactId(), project.getVersion(), null, null, type);
+ project.groupId(), project.artifactId(), project.version(), null, null, type);
attachArtifact(project, artifact, path);
}
diff --git a/api/maven-api-core/src/test/java/org/apache/maven/api/ArtifactCoordinatesTest.java b/api/maven-api-core/src/test/java/org/apache/maven/api/ArtifactCoordinatesTest.java
index badffe5cb2..08bb0241d6 100644
--- a/api/maven-api-core/src/test/java/org/apache/maven/api/ArtifactCoordinatesTest.java
+++ b/api/maven-api-core/src/test/java/org/apache/maven/api/ArtifactCoordinatesTest.java
@@ -40,30 +40,30 @@ private static ArtifactCoordinates stub(
String groupId, String artifactId, String extension, String classifier, String version) {
return new ArtifactCoordinates() {
@Override
- public String getGroupId() {
+ public String groupId() {
return groupId;
}
@Override
- public String getArtifactId() {
+ public String artifactId() {
return artifactId;
}
@Override
- public String getClassifier() {
+ public String classifier() {
return classifier;
}
@Override
- public VersionConstraint getVersionConstraint() {
+ public VersionConstraint versionConstraint() {
return new VersionConstraint() {
@Override
- public VersionRange getVersionRange() {
+ public VersionRange versionRange() {
return null;
}
@Override
- public Version getRecommendedVersion() {
+ public Version recommendedVersion() {
return null;
}
@@ -80,7 +80,7 @@ public String toString() {
}
@Override
- public String getExtension() {
+ public String extension() {
return extension;
}
};
diff --git a/api/maven-api-core/src/test/java/org/apache/maven/api/SourceRootTest.java b/api/maven-api-core/src/test/java/org/apache/maven/api/SourceRootTest.java
index a192370839..a672b53dc8 100644
--- a/api/maven-api-core/src/test/java/org/apache/maven/api/SourceRootTest.java
+++ b/api/maven-api-core/src/test/java/org/apache/maven/api/SourceRootTest.java
@@ -79,9 +79,9 @@ void testTargetPath() {
when(build.getTestOutputDirectory()).thenReturn("target/test-classes");
Project project = mock(Project.class);
- when(project.getBuild()).thenReturn(build);
- when(project.getBasedir()).thenReturn(Path.of("myproject"));
- when(project.getOutputDirectory(any(ProjectScope.class))).thenCallRealMethod();
+ when(project.build()).thenReturn(build);
+ when(project.basedir()).thenReturn(Path.of("myproject"));
+ when(project.outputDirectory(any(ProjectScope.class))).thenCallRealMethod();
assertEquals(Path.of("myproject", "target", "classes"), targetPath(project));
diff --git a/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java b/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java
index 5c53a246a5..9f584bf0af 100644
--- a/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java
+++ b/impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProject.java
@@ -75,25 +75,25 @@ public MavenProject getProject() {
@Nonnull
@Override
- public String getGroupId() {
+ public String groupId() {
return project.getGroupId();
}
@Nonnull
@Override
- public String getArtifactId() {
+ public String artifactId() {
return project.getArtifactId();
}
@Nonnull
@Override
- public String getVersion() {
+ public String version() {
return project.getVersion();
}
@Nonnull
@Override
- public List<ProducedArtifact> getArtifacts() {
+ public List<ProducedArtifact> artifacts() {
org.eclipse.aether.artifact.Artifact pomArtifact = RepositoryUtils.toArtifact(new ProjectArtifact(project));
org.eclipse.aether.artifact.Artifact projectArtifact = RepositoryUtils.toArtifact(project.getArtifact());
@@ -107,40 +107,40 @@ public List<ProducedArtifact> getArtifacts() {
@Nonnull
@Override
- public Packaging getPackaging() {
+ public Packaging packaging() {
return packaging;
}
@Nonnull
@Override
- public Model getModel() {
+ public Model model() {
return project.getModel().getDelegate();
}
@Nonnull
@Override
- public Path getPomPath() {
+ public Path pomPath() {
return Objects.requireNonNull(project.getFile(), "pomPath cannot be null")
.toPath();
}
@Nonnull
@Override
- public Path getBasedir() {
+ public Path basedir() {
return Objects.requireNonNull(project.getBasedir(), "basedir cannot be null")
.toPath();
}
@Nonnull
@Override
- public List<DependencyCoordinates> getDependencies() {
- return new MappedList<>(getModel().getDependencies(), this::toDependency);
+ public List<DependencyCoordinates> dependencies() {
+ return new MappedList<>(model().getDependencies(), this::toDependency);
}
@Nonnull
@Override
- public List<DependencyCoordinates> getManagedDependencies() {
- DependencyManagement dependencyManagement = getModel().getDependencyManagement();
+ public List<DependencyCoordinates> managedDependencies() {
+ DependencyManagement dependencyManagement = model().getDependencyManagement();
if (dependencyManagement != null) {
return new MappedList<>(dependencyManagement.getDependencies(), this::toDependency);
}
@@ -149,34 +149,34 @@ public List<DependencyCoordinates> getManagedDependencies() {
@Override
public boolean isTopProject() {
- return getBasedir().equals(getSession().getTopDirectory());
+ return basedir().equals(getSession().getTopDirectory());
}
@Override
public boolean isRootProject() {
- return getBasedir().equals(getRootDirectory());
+ return basedir().equals(rootDirectory());
}
@Override
- public Path getRootDirectory() {
+ public Path rootDirectory() {
return project.getRootDirectory();
}
@Override
- public Optional<Project> getParent() {
+ public Optional<Project> parent() {
MavenProject parent = project.getParent();
return Optional.ofNullable(session.getProject(parent));
}
@Override
@Nonnull
- public List<Profile> getDeclaredProfiles() {
- return getModel().getProfiles();
+ public List<Profile> declaredProfiles() {
+ return model().getProfiles();
}
@Override
@Nonnull
- public List<Profile> getEffectiveProfiles() {
+ public List<Profile> effectiveProfiles() {
return Stream.iterate(this.project, Objects::nonNull, MavenProject::getParent)
.flatMap(project -> project.getModel().getDelegate().getProfiles().stream())
.toList();
@@ -184,7 +184,7 @@ public List<Profile> getEffectiveProfiles() {
@Override
@Nonnull
- public List<Profile> getDeclaredActiveProfiles() {
+ public List<Profile> declaredActiveProfiles() {
return project.getActiveProfiles().stream()
.map(org.apache.maven.model.Profile::getDelegate)
.toList();
@@ -192,7 +192,7 @@ public List<Profile> getDeclaredActiveProfiles() {
@Override
@Nonnull
- public List<Profile> getEffectiveActiveProfiles() {
+ public List<Profile> effectiveActiveProfiles() {
return Stream.iterate(this.project, Objects::nonNull, MavenProject::getParent)
.flatMap(project -> project.getActiveProfiles().stream())
.map(org.apache.maven.model.Profile::getDelegate)
@@ -203,20 +203,20 @@ public List<Profile> getEffectiveActiveProfiles() {
private DependencyCoordinates toDependency(org.apache.maven.api.model.Dependency dependency) {
return new DependencyCoordinates() {
@Override
- public String getGroupId() {
+ public String groupId() {
return dependency.getGroupId();
}
@Override
- public String getArtifactId() {
+ public String artifactId() {
return dependency.getArtifactId();
}
@Override
- public String getClassifier() {
+ public String classifier() {
String classifier = dependency.getClassifier();
if (classifier == null || classifier.isEmpty()) {
- classifier = getType().getClassifier();
+ classifier = type().getClassifier();
if (classifier == null) {
classifier = "";
}
@@ -225,24 +225,24 @@ public String getClassifier() {
}
@Override
- public VersionConstraint getVersionConstraint() {
+ public VersionConstraint versionConstraint() {
return session.parseVersionConstraint(dependency.getVersion());
}
@Override
- public String getExtension() {
- return getType().getExtension();
+ public String extension() {
+ return type().getExtension();
}
@Override
- public Type getType() {
+ public Type type() {
String type = dependency.getType();
return session.requireType(type);
}
@Nonnull
@Override
- public DependencyScope getScope() {
+ public DependencyScope scope() {
String scope = dependency.getScope();
if (scope == null) {
scope = "";
@@ -251,13 +251,13 @@ public DependencyScope getScope() {
}
@Override
- public Boolean getOptional() {
+ public Boolean optional() {
return dependency.isOptional();
}
@Nonnull
@Override
- public Collection<Exclusion> getExclusions() {
+ public Collection<Exclusion> exclusions() {
return new MappedCollection<>(dependency.getExclusions(), this::toExclusion);
}
@@ -265,13 +265,13 @@ private Exclusion toExclusion(org.apache.maven.api.model.Exclusion exclusion) {
return new Exclusion() {
@Nullable
@Override
- public String getGroupId() {
+ public String groupId() {
return exclusion.getGroupId();
}
@Nullable
@Override
- public String getArtifactId() {
+ public String artifactId() {
return exclusion.getArtifactId();
}
};
diff --git a/impl/maven-core/src/test/java/org/apache/maven/internal/transformation/impl/ConsumerPomBuilderTest.java b/impl/maven-core/src/test/java/org/apache/maven/internal/transformation/impl/ConsumerPomBuilderTest.java
index 5f6661a665..2bedd4b444 100644
--- a/impl/maven-core/src/test/java/org/apache/maven/internal/transformation/impl/ConsumerPomBuilderTest.java
+++ b/impl/maven-core/src/test/java/org/apache/maven/internal/transformation/impl/ConsumerPomBuilderTest.java
@@ -95,7 +95,7 @@ protected List<Object> getSessionServices() {
Node node = Mockito.mock(Node.class);
Mockito.when(resolverResult.getRoot()).thenReturn(node);
Node child = Mockito.mock(Node.class);
- Mockito.when(node.getChildren()).thenReturn(List.of(child));
+ Mockito.when(node.children()).thenReturn(List.of(child));
services.addAll(List.of(
new DefaultRequestCacheFactory(),
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractNode.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractNode.java
index ad0dea065f..b49a390eba 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractNode.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractNode.java
@@ -33,7 +33,7 @@ public abstract class AbstractNode implements Node {
@Override
public boolean accept(NodeVisitor visitor) {
if (visitor.enter(this)) {
- for (Node child : getChildren()) {
+ for (Node child : children()) {
if (!child.accept(visitor)) {
break;
}
@@ -45,7 +45,7 @@ public boolean accept(NodeVisitor visitor) {
@Override
public Node filter(Predicate<Node> filter) {
List<Node> children =
- getChildren().stream().filter(filter).map(n -> n.filter(filter)).collect(Collectors.toList());
+ children().stream().filter(filter).map(n -> n.filter(filter)).collect(Collectors.toList());
return new WrapperNode(this, Collections.unmodifiableList(children));
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java
index bdce42779a..f339ed298b 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/AbstractSession.java
@@ -227,13 +227,13 @@ public WorkspaceRepository getWorkspaceRepository(org.eclipse.aether.repository.
return new WorkspaceRepository() {
@Nonnull
@Override
- public String getId() {
+ public String id() {
return repository.getId();
}
@Nonnull
@Override
- public String getType() {
+ public String type() {
return repository.getContentType();
}
};
@@ -393,7 +393,7 @@ public LocalRepository getLocalRepository() {
public Session withLocalRepository(@Nonnull LocalRepository localRepository) {
requireNonNull(localRepository, "localRepository");
if (session.getLocalRepository() != null
- && Objects.equals(session.getLocalRepository().getBasePath(), localRepository.getPath())) {
+ && Objects.equals(session.getLocalRepository().getBasePath(), localRepository.path())) {
return this;
}
org.eclipse.aether.repository.LocalRepository repository = toRepository(localRepository);
@@ -921,7 +921,7 @@ public Node collectDependencies(@Nonnull DependencyCoordinates dependency, @Nonn
Node root = getService(DependencyResolver.class)
.collect(this, dependency, scope)
.getRoot();
- return root.getChildren().iterator().next();
+ return root.children().iterator().next();
}
@Nonnull
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/AetherDependencyWrapper.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/AetherDependencyWrapper.java
index a9721290c2..4953db44fc 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/AetherDependencyWrapper.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/AetherDependencyWrapper.java
@@ -61,7 +61,7 @@ abstract class AetherDependencyWrapper {
* {@return the group identifier of the wrapped dependency}
* The default implementation delegates to the Eclipse Aether artifact.
*/
- public String getGroupId() {
+ public String groupId() {
return dependency.getArtifact().getGroupId();
}
@@ -69,7 +69,7 @@ public String getGroupId() {
* {@return the artifact identifier of the wrapped dependency}
* The default implementation delegates to the Eclipse Aether artifact.
*/
- public String getArtifactId() {
+ public String artifactId() {
return dependency.getArtifact().getArtifactId();
}
@@ -77,7 +77,7 @@ public String getArtifactId() {
* {@return the file extension of the wrapped dependency}
* The default implementation delegates to the Eclipse Aether artifact.
*/
- public String getExtension() {
+ public String extension() {
return dependency.getArtifact().getExtension();
}
@@ -85,8 +85,8 @@ public String getExtension() {
* {@return the type of the wrapped dependency}
* The default implementation infers the type from the properties associated to the Eclipse Aether artifact.
*/
- public Type getType() {
- String type = dependency.getArtifact().getProperty(ArtifactProperties.TYPE, getExtension());
+ public Type type() {
+ String type = dependency.getArtifact().getProperty(ArtifactProperties.TYPE, extension());
return session.requireType(type);
}
@@ -94,13 +94,13 @@ public Type getType() {
* {@return the classifier ("jar", "test-jar", …) of the wrapped dependency}
* The default implementation first delegates to the Eclipse Aether artifact.
* If the latter does not provide a non-empty classifier,
- * then the default value is determined by {@linkplain #getType() type}.
+ * then the default value is determined by {@linkplain #type() type}.
*/
@Nonnull
- public String getClassifier() {
+ public String classifier() {
String classifier = dependency.getArtifact().getClassifier();
if (classifier.isEmpty()) {
- classifier = getType().getClassifier();
+ classifier = type().getClassifier();
if (classifier == null) {
classifier = "";
}
@@ -112,7 +112,7 @@ public String getClassifier() {
* {@return the scope (compile, test, …) of this dependency}
*/
@Nonnull
- public DependencyScope getScope() {
+ public DependencyScope scope() {
return session.requireDependencyScope(dependency.getScope());
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifact.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifact.java
index 4e034569ea..f3cffe7a50 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifact.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifact.java
@@ -38,14 +38,14 @@ public class DefaultArtifact implements Artifact {
public DefaultArtifact(@Nonnull InternalSession session, @Nonnull org.eclipse.aether.artifact.Artifact artifact) {
this.session = requireNonNull(session, "session");
this.artifact = requireNonNull(artifact, "artifact");
- this.key = getGroupId()
+ this.key = groupId()
+ ':'
- + getArtifactId()
+ + artifactId()
+ ':'
- + getExtension()
- + (getClassifier().isEmpty() ? "" : ":" + getClassifier())
+ + extension()
+ + (classifier().isEmpty() ? "" : ":" + classifier())
+ ':'
- + getVersion();
+ + version();
}
public org.eclipse.aether.artifact.Artifact getArtifact() {
@@ -59,36 +59,36 @@ public String key() {
@Nonnull
@Override
- public String getGroupId() {
+ public String groupId() {
return artifact.getGroupId();
}
@Nonnull
@Override
- public String getArtifactId() {
+ public String artifactId() {
return artifact.getArtifactId();
}
@Nonnull
@Override
- public Version getVersion() {
+ public Version version() {
return session.parseVersion(artifact.getVersion());
}
@Override
- public Version getBaseVersion() {
+ public Version baseVersion() {
return session.parseVersion(artifact.getBaseVersion());
}
@Nonnull
@Override
- public String getExtension() {
+ public String extension() {
return artifact.getExtension();
}
@Nonnull
@Override
- public String getClassifier() {
+ public String classifier() {
return artifact.getClassifier();
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinates.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinates.java
index 61de35a589..8d73ca3b56 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinates.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultArtifactCoordinates.java
@@ -45,30 +45,30 @@ public org.eclipse.aether.artifact.Artifact getCoordinates() {
@Nonnull
@Override
- public String getGroupId() {
+ public String groupId() {
return coordinates.getGroupId();
}
@Nonnull
@Override
- public String getArtifactId() {
+ public String artifactId() {
return coordinates.getArtifactId();
}
@Nonnull
@Override
- public VersionConstraint getVersionConstraint() {
+ public VersionConstraint versionConstraint() {
return session.parseVersionConstraint(coordinates.getVersion());
}
@Override
- public String getExtension() {
+ public String extension() {
return coordinates.getExtension();
}
@Nonnull
@Override
- public String getClassifier() {
+ public String classifier() {
return coordinates.getClassifier();
}
@@ -81,16 +81,16 @@ public boolean equals(Object o) {
return false;
}
DefaultArtifactCoordinates that = (DefaultArtifactCoordinates) o;
- return Objects.equals(this.getGroupId(), that.getGroupId())
- && Objects.equals(this.getArtifactId(), that.getArtifactId())
- && Objects.equals(this.getVersionConstraint(), that.getVersionConstraint())
- && Objects.equals(this.getExtension(), that.getExtension())
- && Objects.equals(this.getClassifier(), that.getClassifier());
+ return Objects.equals(this.groupId(), that.groupId())
+ && Objects.equals(this.artifactId(), that.artifactId())
+ && Objects.equals(this.versionConstraint(), that.versionConstraint())
+ && Objects.equals(this.extension(), that.extension())
+ && Objects.equals(this.classifier(), that.classifier());
}
@Override
public int hashCode() {
- return Objects.hash(getGroupId(), getArtifactId(), getVersionConstraint(), getExtension(), getClassifier());
+ return Objects.hash(groupId(), artifactId(), versionConstraint(), extension(), classifier());
}
@Override
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependency.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependency.java
index 8bf6333e25..82fcacfe93 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependency.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependency.java
@@ -33,14 +33,14 @@ public class DefaultDependency extends AetherDependencyWrapper implements Depend
public DefaultDependency(
@Nonnull InternalSession session, @Nonnull org.eclipse.aether.graph.Dependency dependency) {
super(session, dependency);
- this.key = getGroupId()
+ this.key = groupId()
+ ':'
- + getArtifactId()
+ + artifactId()
+ ':'
- + getExtension()
- + (!getClassifier().isEmpty() ? ":" + getClassifier() : "")
+ + extension()
+ + (!classifier().isEmpty() ? ":" + classifier() : "")
+ ':'
- + getVersion();
+ + version();
}
@Override
@@ -49,12 +49,12 @@ public String key() {
}
@Override
- public Version getVersion() {
+ public Version version() {
return session.parseVersion(dependency.getArtifact().getVersion());
}
@Override
- public Version getBaseVersion() {
+ public Version baseVersion() {
return session.parseVersion(dependency.getArtifact().getBaseVersion());
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyCoordinates.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyCoordinates.java
index 9128e122c9..262484f2df 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyCoordinates.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyCoordinates.java
@@ -33,19 +33,19 @@ public DefaultDependencyCoordinates(
}
@Override
- public VersionConstraint getVersionConstraint() {
+ public VersionConstraint versionConstraint() {
return session.parseVersionConstraint(dependency.getArtifact().getVersion());
}
@Nullable
@Override
- public Boolean getOptional() {
+ public Boolean optional() {
return dependency.getOptional();
}
@Nonnull
@Override
- public Collection<Exclusion> getExclusions() {
+ public Collection<Exclusion> exclusions() {
return new MappedCollection<>(dependency.getExclusions(), this::toExclusion);
}
@@ -53,13 +53,13 @@ private Exclusion toExclusion(org.eclipse.aether.graph.Exclusion exclusion) {
return new Exclusion() {
@Nullable
@Override
- public String getGroupId() {
+ public String groupId() {
return exclusion.getGroupId();
}
@Nullable
@Override
- public String getArtifactId() {
+ public String artifactId() {
return exclusion.getArtifactId();
}
};
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolver.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolver.java
index f2dab23112..bd7cf5cd6f 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolver.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDependencyResolver.java
@@ -252,13 +252,13 @@ public DependencyResolverResult resolve(DependencyResolverRequest request)
ArtifactResolverResult artifactResolverResult =
session.getService(ArtifactResolver.class).resolve(session, coordinates, repositories);
for (Node node : nodes) {
- Path path = (node.getArtifact() != null)
+ Path path = (node.artifact() != null)
? artifactResolverResult
- .getResult(node.getArtifact().toCoordinates())
+ .getResult(node.artifact().toCoordinates())
.getPath()
: null;
try {
- resolverResult.addDependency(node, node.getDependency(), filter, path);
+ resolverResult.addDependency(node, node.dependency(), filter, path);
} catch (IOException e) {
throw cannotReadModuleInfo(path, e);
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDownloadedArtifact.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDownloadedArtifact.java
index e5dc30e809..873012a3f6 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDownloadedArtifact.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultDownloadedArtifact.java
@@ -34,7 +34,7 @@ public DefaultDownloadedArtifact(
}
@Override
- public Path getPath() {
+ public Path path() {
return artifact.getPath();
}
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultLocalRepository.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultLocalRepository.java
index be5626c81f..9342fdbac2 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultLocalRepository.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultLocalRepository.java
@@ -40,19 +40,19 @@ public org.eclipse.aether.repository.LocalRepository getRepository() {
@Nonnull
@Override
- public String getId() {
+ public String id() {
return repository.getId();
}
@Nonnull
@Override
- public String getType() {
+ public String type() {
return repository.getContentType();
}
@Nonnull
@Override
- public Path getPath() {
+ public Path path() {
return repository.getBasePath();
}
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelVersionParser.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelVersionParser.java
index 7bec04c926..c75b9b76f5 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelVersionParser.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultModelVersionParser.java
@@ -152,14 +152,14 @@ public boolean contains(Version version) {
}
@Override
- public Boundary getUpperBoundary() {
+ public Boundary upperBoundary() {
org.eclipse.aether.version.VersionRange.Bound bound = delegate.getUpperBound();
if (bound == null) {
return null;
}
return new Boundary() {
@Override
- public Version getVersion() {
+ public Version version() {
return new DefaultVersion(versionScheme, bound.getVersion());
}
@@ -171,14 +171,14 @@ public boolean isInclusive() {
}
@Override
- public Boundary getLowerBoundary() {
+ public Boundary lowerBoundary() {
org.eclipse.aether.version.VersionRange.Bound bound = delegate.getLowerBound();
if (bound == null) {
return null;
}
return new Boundary() {
@Override
- public Version getVersion() {
+ public Version version() {
return new DefaultVersion(versionScheme, bound.getVersion());
}
@@ -236,7 +236,7 @@ public boolean contains(Version version) {
}
@Override
- public VersionRange getVersionRange() {
+ public VersionRange versionRange() {
if (delegate.getRange() == null) {
return null;
}
@@ -244,7 +244,7 @@ public VersionRange getVersionRange() {
}
@Override
- public Version getRecommendedVersion() {
+ public Version recommendedVersion() {
if (delegate.getVersion() == null) {
return null;
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java
index 340c7e5ed0..269f2c9d73 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultNode.java
@@ -53,27 +53,27 @@ DependencyNode getDependencyNode() {
}
@Override
- public Artifact getArtifact() {
+ public Artifact artifact() {
return node.getArtifact() != null ? session.getArtifact(node.getArtifact()) : null;
}
@Override
- public Dependency getDependency() {
+ public Dependency dependency() {
return node.getDependency() != null ? session.getDependency(node.getDependency()) : null;
}
@Override
- public List<Node> getChildren() {
+ public List<Node> children() {
return new MappedList<>(node.getChildren(), n -> session.getNode(n, verbose));
}
@Override
- public List<RemoteRepository> getRemoteRepositories() {
+ public List<RemoteRepository> remoteRepositories() {
return new MappedList<>(node.getRepositories(), session::getRemoteRepository);
}
@Override
- public Optional<RemoteRepository> getRepository() {
+ public Optional<RemoteRepository> repository() {
org.eclipse.aether.artifact.Artifact artifact = node.getArtifact();
List<org.eclipse.aether.repository.RemoteRepository> repos = node.getRepositories();
if (artifact == null || repos.isEmpty()) {
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
index 85de3f664a..c16f986f3a 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultRemoteRepository.java
@@ -36,25 +36,25 @@ public org.eclipse.aether.repository.RemoteRepository getRepository() {
@Nonnull
@Override
- public String getId() {
+ public String id() {
return repository.getId();
}
@Nonnull
@Override
- public String getType() {
+ public String type() {
return repository.getContentType();
}
@Nonnull
@Override
- public String getUrl() {
+ public String url() {
return repository.getUrl();
}
@Nonnull
@Override
- public String getProtocol() {
+ public String protocol() {
return repository.getProtocol();
}
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultTransportProvider.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultTransportProvider.java
index 1530f9d75a..89399a4528 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultTransportProvider.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/DefaultTransportProvider.java
@@ -47,7 +47,7 @@ public DefaultTransportProvider(TransporterProvider transporterProvider) {
@Override
public Transport transport(Session session, RemoteRepository repository) {
try {
- URI baseURI = new URI(repository.getUrl());
+ URI baseURI = new URI(repository.url());
return new DefaultTransport(
baseURI,
transporterProvider.newTransporter(
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/WrapperNode.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/WrapperNode.java
index a057b68a5e..c282ed22e8 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/WrapperNode.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/WrapperNode.java
@@ -43,30 +43,30 @@ DependencyNode getDependencyNode() {
}
@Override
- public List<Node> getChildren() {
+ public List<Node> children() {
return children;
}
@Override
- public Artifact getArtifact() {
- return delegate.getArtifact();
+ public Artifact artifact() {
+ return delegate.artifact();
}
@Override
- public Dependency getDependency() {
- return delegate.getDependency();
+ public Dependency dependency() {
+ return delegate.dependency();
}
@Override
@Nonnull
- public List<RemoteRepository> getRemoteRepositories() {
- return delegate.getRemoteRepositories();
+ public List<RemoteRepository> remoteRepositories() {
+ return delegate.remoteRepositories();
}
@Override
@Nonnull
- public Optional<RemoteRepository> getRepository() {
- return delegate.getRepository();
+ public Optional<RemoteRepository> repository() {
+ return delegate.repository();
}
@Override
diff --git a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
index 5bc8e7ea34..f0e6591159 100644
--- a/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
+++ b/impl/maven-impl/src/main/java/org/apache/maven/impl/model/DefaultModelBuilder.java
@@ -338,10 +338,10 @@ private static List<RemoteRepository> mergeRepositoriesById(List<RemoteRepositor
LinkedHashMap<String, RemoteRepository> byId = new LinkedHashMap<>();
boolean hasDuplicates = false;
for (RemoteRepository repo : repos) {
- RemoteRepository existing = byId.putIfAbsent(repo.getId(), repo);
+ RemoteRepository existing = byId.putIfAbsent(repo.id(), repo);
if (existing != null) {
hasDuplicates = true;
- byId.put(repo.getId(), mergeRepositoryPolicies(existing, repo));
+ byId.put(repo.id(), mergeRepositoryPolicies(existing, repo));
}
}
return hasDuplicates ? List.copyOf(byId.values()) : List.copyOf(repos);
@@ -680,17 +680,16 @@ public void mergeRepositories(Model model, boolean replace) {
// build request has a well-defined set of session/request repositories that
// should take precedence; dependency and parent resolution do not.
if (replace && isBuildRequest()) {
- Set<String> ids = repos.stream().map(RemoteRepository::getId).collect(Collectors.toSet());
- repositories = repositories.stream()
- .filter(r -> !ids.contains(r.getId()))
- .toList();
+ Set<String> ids = repos.stream().map(RemoteRepository::id).collect(Collectors.toSet());
+ repositories =
+ repositories.stream().filter(r -> !ids.contains(r.id())).toList();
pomRepositories = pomRepositories.stream()
- .filter(r -> !ids.contains(r.getId()))
+ .filter(r -> !ids.contains(r.id()))
.toList();
} else {
Set<String> ids =
- pomRepositories.stream().map(RemoteRepository::getId).collect(Collectors.toSet());
- repos = repos.stream().filter(r -> !ids.contains(r.getId())).toList();
+ pomRepositories.stream().map(RemoteRepository::id).collect(Collectors.toSet());
+ repos = repos.stream().filter(r -> !ids.contains(r.id())).toList();
}
RepositoryFactory repositoryFactory = session.getService(RepositoryFactory.class);
diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultArtifactCoordinatesTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultArtifactCoordinatesTest.java
index bc0e525acc..2a07705d9e 100644
--- a/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultArtifactCoordinatesTest.java
+++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/DefaultArtifactCoordinatesTest.java
@@ -48,12 +48,12 @@ private static final class StubVC implements VersionConstraint {
}
@Override
- public VersionRange getVersionRange() {
+ public VersionRange versionRange() {
return null;
}
@Override
- public Version getRecommendedVersion() {
+ public Version recommendedVersion() {
return null;
}
diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/RequestTraceTest.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/RequestTraceTest.java
index 05ec85e270..f1697c3a44 100644
--- a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/RequestTraceTest.java
+++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/RequestTraceTest.java
@@ -97,7 +97,7 @@ public void artifactResolved(RepositoryEvent event) {
.pathScope(PathScope.MAIN_RUNTIME)
.build())
.getRoot()
- .getChildren()
+ .children()
.iterator()
.next();
@@ -112,7 +112,7 @@ public void artifactResolved(RepositoryEvent event) {
assertTrue(session.getListeners().isEmpty());
assertTrue(derived.getListeners().isEmpty());
assertNotNull(node);
- assertEquals(6, node.getChildren().size());
+ assertEquals(6, node.children().size());
}
@Provides
diff --git a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/TestApiStandalone.java b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/TestApiStandalone.java
index 2880e1c17d..a5f897b38e 100644
--- a/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/TestApiStandalone.java
+++ b/impl/maven-impl/src/test/java/org/apache/maven/impl/standalone/TestApiStandalone.java
@@ -75,7 +75,7 @@ void testStandalone() {
Node node = session.collectDependencies(session.createDependencyCoordinates(coords), PathScope.MAIN_RUNTIME);
assertNotNull(node);
- assertEquals(6, node.getChildren().size());
+ assertEquals(6, node.children().size());
}
@Provides
diff --git a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ArtifactStub.java b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ArtifactStub.java
index ce0a339708..20be8feeea 100644
--- a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ArtifactStub.java
+++ b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ArtifactStub.java
@@ -61,7 +61,7 @@ public ArtifactStub(String groupId, String artifactId, String classifier, String
@Nonnull
@Override
- public String getGroupId() {
+ public String groupId() {
return groupId;
}
@@ -71,7 +71,7 @@ public void setGroupId(String groupId) {
@Nonnull
@Override
- public String getArtifactId() {
+ public String artifactId() {
return artifactId;
}
@@ -81,7 +81,7 @@ public void setArtifactId(String artifactId) {
@Nonnull
@Override
- public String getClassifier() {
+ public String classifier() {
return classifier;
}
@@ -91,7 +91,7 @@ public void setClassifier(String classifier) {
@Nonnull
@Override
- public Version getVersion() {
+ public Version version() {
return getParser().parseVersion(version);
}
@@ -100,7 +100,7 @@ public void setVersion(String version) {
}
@Override
- public Version getBaseVersion() {
+ public Version baseVersion() {
return getParser().parseVersion(baseVersion != null ? baseVersion : version);
}
@@ -110,7 +110,7 @@ public void setBaseVersion(String baseVersion) {
@Nonnull
@Override
- public String getExtension() {
+ public String extension() {
return extension;
}
@@ -127,27 +127,27 @@ public boolean isSnapshot() {
public ArtifactCoordinates toCoordinates() {
return new ArtifactCoordinates() {
@Override
- public String getGroupId() {
+ public String groupId() {
return groupId;
}
@Override
- public String getArtifactId() {
+ public String artifactId() {
return artifactId;
}
@Override
- public String getClassifier() {
+ public String classifier() {
return classifier;
}
@Override
- public VersionConstraint getVersionConstraint() {
+ public VersionConstraint versionConstraint() {
return getParser().parseVersionConstraint(version);
}
@Override
- public String getExtension() {
+ public String extension() {
return extension;
}
};
diff --git a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ProjectStub.java b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ProjectStub.java
index d00427d19f..16424045cd 100644
--- a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ProjectStub.java
+++ b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/ProjectStub.java
@@ -63,19 +63,19 @@ public void setModel(Model model) {
@Nonnull
@Override
- public String getGroupId() {
+ public String groupId() {
return model.getGroupId();
}
@Nonnull
@Override
- public String getArtifactId() {
+ public String artifactId() {
return model.getArtifactId();
}
@Nonnull
@Override
- public String getVersion() {
+ public String version() {
return model.getVersion();
}
@@ -85,7 +85,7 @@ public String getName() {
@Nonnull
@Override
- public Packaging getPackaging() {
+ public Packaging packaging() {
return new Packaging() {
@Override
public String id() {
@@ -135,42 +135,42 @@ public Map<String, PluginContainer> plugins() {
}
@Override
- public List<ProducedArtifact> getArtifacts() {
- ProducedArtifact pomArtifact = new ProducedArtifactStub(getGroupId(), getArtifactId(), "", getVersion(), "pom");
+ public List<ProducedArtifact> artifacts() {
+ ProducedArtifact pomArtifact = new ProducedArtifactStub(groupId(), artifactId(), "", version(), "pom");
return mainArtifact != null ? Arrays.asList(pomArtifact, mainArtifact) : Arrays.asList(pomArtifact);
}
@Nonnull
@Override
- public Model getModel() {
+ public Model model() {
return model;
}
@Nonnull
@Override
- public Path getPomPath() {
+ public Path pomPath() {
return pomPath;
}
@Nonnull
@Override
- public List<DependencyCoordinates> getDependencies() {
+ public List<DependencyCoordinates> dependencies() {
return null;
}
@Nonnull
@Override
- public List<DependencyCoordinates> getManagedDependencies() {
+ public List<DependencyCoordinates> managedDependencies() {
return null;
}
@Override
- public Path getBasedir() {
+ public Path basedir() {
return basedir;
}
@Override
- public Optional<Project> getParent() {
+ public Optional<Project> parent() {
return Optional.empty();
}
@@ -185,7 +185,7 @@ public boolean isRootProject() {
}
@Override
- public Path getRootDirectory() {
+ public Path rootDirectory() {
return rootDirectory;
}
@@ -262,7 +262,7 @@ public ProjectStub addProperty(String key, String value) {
@Override
@SuppressWarnings("ReturnOfCollectionOrArrayField") // Safe because list is unmodifiable.
- public List<Profile> getDeclaredProfiles() {
+ public List<Profile> declaredProfiles() {
return declaredProfiles;
}
@@ -272,7 +272,7 @@ public void setDeclaredProfiles(List<Profile> values) {
@Override
@SuppressWarnings("ReturnOfCollectionOrArrayField") // Safe because list is unmodifiable.
- public List<Profile> getEffectiveProfiles() {
+ public List<Profile> effectiveProfiles() {
return effectiveProfiles;
}
@@ -282,7 +282,7 @@ public void setEffectiveProfiles(List<Profile> values) {
@Override
@SuppressWarnings("ReturnOfCollectionOrArrayField") // Safe because list is unmodifiable.
- public List<Profile> getDeclaredActiveProfiles() {
+ public List<Profile> declaredActiveProfiles() {
return declaredActiveProfiles;
}
@@ -292,7 +292,7 @@ public void setDeclaredActiveProfiles(List<Profile> values) {
@Override
@SuppressWarnings("ReturnOfCollectionOrArrayField") // Safe because list is unmodifiable.
- public List<Profile> getEffectiveActiveProfiles() {
+ public List<Profile> effectiveActiveProfiles() {
return effectiveActiveProfiles;
}
diff --git a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionMock.java b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionMock.java
index a4a1131b6e..26d5ddd69f 100644
--- a/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionMock.java
+++ b/impl/maven-testing/src/main/java/org/apache/maven/testing/plugin/stubs/SessionMock.java
@@ -131,8 +131,8 @@ public class SessionMock {
public static InternalSession getMockSession(String localRepo) {
LocalRepository localRepository = mock(LocalRepository.class);
- when(localRepository.getId()).thenReturn("local");
- when(localRepository.getPath()).thenReturn(Paths.get(localRepo));
+ when(localRepository.id()).thenReturn("local");
+ when(localRepository.path()).thenReturn(Paths.get(localRepo));
return getMockSession(localRepository);
}
@@ -160,9 +160,9 @@ public static InternalSession getMockSession(LocalRepository localRepository) {
String url = iom.getArgument(1, String.class);
RemoteRepository remoteRepository =
mock(RemoteRepository.class, withSettings().strictness(Strictness.LENIENT));
- when(remoteRepository.getId()).thenReturn(id);
- when(remoteRepository.getUrl()).thenReturn(url);
- when(remoteRepository.getProtocol()).thenReturn(URI.create(url).getScheme());
+ when(remoteRepository.id()).thenReturn(id);
+ when(remoteRepository.url()).thenReturn(url);
+ when(remoteRepository.protocol()).thenReturn(URI.create(url).getScheme());
return remoteRepository;
});
when(session.getService(RepositoryFactory.class)).thenReturn(repositoryFactory);
@@ -193,7 +193,7 @@ public static InternalSession getMockSession(LocalRepository localRepository) {
.thenAnswer(iom -> {
LocalRepository localRepo = iom.getArgument(1, LocalRepository.class);
Artifact artifact = iom.getArgument(2, Artifact.class);
- return localRepo.getPath().resolve(getPathForArtifact(artifact));
+ return localRepo.path().resolve(getPathForArtifact(artifact));
});
when(session.getService(LocalRepositoryManager.class)).thenReturn(localRepositoryManager);