diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java index 150cd7ea71..830bb0f5ed 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Session.java @@ -521,7 +521,7 @@ public interface Session { * * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection) */ - void installArtifacts(@Nonnull Artifact... artifacts); + void installArtifacts(@Nonnull ProducedArtifact... artifacts); /** * Shortcut for {@code getService(ArtifactInstaller.class).install(...)}. @@ -531,7 +531,7 @@ public interface Session { * * @see org.apache.maven.api.services.ArtifactInstaller#install(Session, Collection) */ - void installArtifacts(@Nonnull Collection artifacts); + void installArtifacts(@Nonnull Collection artifacts); /** * Shortcut for {@code getService(ArtifactDeployer.class).deploy(...)}. @@ -542,7 +542,7 @@ public interface Session { * * @see org.apache.maven.api.services.ArtifactDeployer#deploy(Session, RemoteRepository, Collection) */ - void deployArtifact(@Nonnull RemoteRepository repository, @Nonnull Artifact... artifacts); + void deployArtifact(@Nonnull RemoteRepository repository, @Nonnull ProducedArtifact... artifacts); /** * Shortcut for {@code getService(ArtifactManager.class).setPath(...)}. diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java index fbe97fea6c..d041960d57 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployer.java @@ -20,7 +20,7 @@ package org.apache.maven.api.services; import java.util.Collection; -import org.apache.maven.api.Artifact; +import org.apache.maven.api.ProducedArtifact; import org.apache.maven.api.RemoteRepository; import org.apache.maven.api.Service; import org.apache.maven.api.Session; @@ -28,10 +28,10 @@ import org.apache.maven.api.annotations.Experimental; import org.apache.maven.api.annotations.Nonnull; /** - * Deploys {@link Artifact}s to a {@link RemoteRepository}. + * Deploys {@link ProducedArtifact}s to a {@link RemoteRepository}. * * @since 4.0.0 - * @see Session#deployArtifact(RemoteRepository, Artifact...) + * @see Session#deployArtifact(RemoteRepository, ProducedArtifact...) */ @Experimental public interface ArtifactDeployer extends Service { @@ -50,7 +50,9 @@ public interface ArtifactDeployer extends Service { * @throws IllegalArgumentException if an argument is {@code null} or invalid */ default void deploy( - @Nonnull Session session, @Nonnull RemoteRepository repository, @Nonnull Collection artifacts) { + @Nonnull Session session, + @Nonnull RemoteRepository repository, + @Nonnull Collection artifacts) { deploy(ArtifactDeployerRequest.build(session, repository, artifacts)); } } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java index f5146bf956..b6bc678166 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactDeployerRequest.java @@ -20,7 +20,7 @@ package org.apache.maven.api.services; import java.util.Collection; -import org.apache.maven.api.Artifact; +import org.apache.maven.api.ProducedArtifact; import org.apache.maven.api.RemoteRepository; import org.apache.maven.api.Session; import org.apache.maven.api.annotations.Experimental; @@ -45,7 +45,7 @@ public interface ArtifactDeployerRequest { RemoteRepository getRepository(); @Nonnull - Collection getArtifacts(); + Collection getArtifacts(); int getRetryFailedDeploymentCount(); @@ -56,7 +56,9 @@ public interface ArtifactDeployerRequest { @Nonnull static ArtifactDeployerRequest build( - @Nonnull Session session, @Nonnull RemoteRepository repository, @Nonnull Collection artifacts) { + @Nonnull Session session, + @Nonnull RemoteRepository repository, + @Nonnull Collection artifacts) { return builder() .session(nonNull(session, "session cannot be null")) .repository(nonNull(repository, "repository cannot be null")) @@ -67,7 +69,7 @@ public interface ArtifactDeployerRequest { class ArtifactDeployerRequestBuilder { Session session; RemoteRepository repository; - Collection artifacts; + Collection artifacts; int retryFailedDeploymentCount; ArtifactDeployerRequestBuilder() {} @@ -84,7 +86,7 @@ public interface ArtifactDeployerRequest { return this; } - public ArtifactDeployerRequestBuilder artifacts(Collection artifacts) { + public ArtifactDeployerRequestBuilder artifacts(Collection artifacts) { this.artifacts = artifacts; return this; } @@ -102,13 +104,13 @@ public interface ArtifactDeployerRequest { private static class DefaultArtifactDeployerRequest extends BaseRequest implements ArtifactDeployerRequest { private final RemoteRepository repository; - private final Collection artifacts; + private final Collection artifacts; private final int retryFailedDeploymentCount; DefaultArtifactDeployerRequest( @Nonnull Session session, @Nonnull RemoteRepository repository, - @Nonnull Collection artifacts, + @Nonnull Collection artifacts, int retryFailedDeploymentCount) { super(session); this.repository = nonNull(repository, "repository cannot be null"); @@ -124,7 +126,7 @@ public interface ArtifactDeployerRequest { @Nonnull @Override - public Collection getArtifacts() { + public Collection getArtifacts() { return artifacts; } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java index 00500ab7eb..35ee9f328d 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstaller.java @@ -21,14 +21,14 @@ package org.apache.maven.api.services; import java.util.Collection; import java.util.Collections; -import org.apache.maven.api.Artifact; +import org.apache.maven.api.ProducedArtifact; import org.apache.maven.api.Service; import org.apache.maven.api.Session; import org.apache.maven.api.annotations.Experimental; import org.apache.maven.api.annotations.Nonnull; /** - * Installs {@link Artifact}s to the local repository. + * Installs {@link ProducedArtifact}s to the local repository. * * @since 4.0.0 * @see Session#withLocalRepository(org.apache.maven.api.LocalRepository) @@ -44,19 +44,19 @@ public interface ArtifactInstaller extends Service { /** * @param session the repository session - * @param artifact the {@link Artifact} to install + * @param artifact the {@link ProducedArtifact} to install * @throws ArtifactInstallerException In case of an error which can be the a given artifact cannot be found or the * installation has failed. * @throws IllegalArgumentException in case of parameter {@code session} is {@code null} or * {@code artifact} is {@code null}. */ - default void install(Session session, Artifact artifact) { + default void install(Session session, ProducedArtifact artifact) { install(session, Collections.singletonList(artifact)); } /** * @param session the repository session - * @param artifacts Collection of {@link Artifact MavenArtifacts} + * @param artifacts Collection of {@link ProducedArtifact MavenArtifacts} * @throws ArtifactInstallerException In case of an error which can be the a given artifact cannot be found or the * installation has failed. * @throws IllegalArgumentException in case of parameter {@code request} is {@code null} or parameter @@ -64,7 +64,7 @@ public interface ArtifactInstaller extends Service { * or parameter {@code mavenArtifacts} is {@code null} or * {@code mavenArtifacts.isEmpty()} is {@code true}. */ - default void install(Session session, Collection artifacts) { + default void install(Session session, Collection artifacts) { install(ArtifactInstallerRequest.build(session, artifacts)); } } diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java index 4ac0142e87..4795b325dd 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/services/ArtifactInstallerRequest.java @@ -21,7 +21,7 @@ package org.apache.maven.api.services; import java.util.Collection; import java.util.Collections; -import org.apache.maven.api.Artifact; +import org.apache.maven.api.ProducedArtifact; import org.apache.maven.api.Session; import org.apache.maven.api.annotations.Experimental; import org.apache.maven.api.annotations.Immutable; @@ -44,7 +44,7 @@ public interface ArtifactInstallerRequest { Session getSession(); @Nonnull - Collection getArtifacts(); + Collection getArtifacts(); @Nonnull static ArtifactInstallerRequestBuilder builder() { @@ -52,7 +52,7 @@ public interface ArtifactInstallerRequest { } @Nonnull - static ArtifactInstallerRequest build(Session session, Collection artifacts) { + static ArtifactInstallerRequest build(Session session, Collection artifacts) { return builder() .session(nonNull(session, "session cannot be null")) .artifacts(nonNull(artifacts, "artifacts cannot be null")) @@ -62,7 +62,7 @@ public interface ArtifactInstallerRequest { @NotThreadSafe class ArtifactInstallerRequestBuilder { Session session; - Collection artifacts = Collections.emptyList(); + Collection artifacts = Collections.emptyList(); ArtifactInstallerRequestBuilder() {} @@ -73,7 +73,7 @@ public interface ArtifactInstallerRequest { } @Nonnull - public ArtifactInstallerRequestBuilder artifacts(@Nullable Collection artifacts) { + public ArtifactInstallerRequestBuilder artifacts(@Nullable Collection artifacts) { this.artifacts = artifacts != null ? artifacts : Collections.emptyList(); return this; } @@ -85,16 +85,16 @@ public interface ArtifactInstallerRequest { static class DefaultArtifactInstallerRequest extends BaseRequest implements ArtifactInstallerRequest { - private final Collection artifacts; + private final Collection artifacts; - DefaultArtifactInstallerRequest(@Nonnull Session session, @Nonnull Collection artifacts) { + DefaultArtifactInstallerRequest(@Nonnull Session session, @Nonnull Collection artifacts) { super(session); this.artifacts = unmodifiable(nonNull(artifacts, "artifacts cannot be null")); } @Nonnull @Override - public Collection getArtifacts() { + public Collection getArtifacts() { return artifacts; } } diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/AbstractSession.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/AbstractSession.java index 232f402626..0054e5ada0 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/AbstractSession.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/AbstractSession.java @@ -344,7 +344,7 @@ public abstract class AbstractSession implements InternalSession { } @Override - public List toArtifacts(Collection artifacts) { + public List toArtifacts(Collection artifacts) { return artifacts == null ? null : map(artifacts, this::toArtifact); } @@ -637,7 +637,7 @@ public abstract class AbstractSession implements InternalSession { * @see ArtifactInstaller#install(Session, Collection) */ @Override - public void installArtifacts(Artifact... artifacts) { + public void installArtifacts(ProducedArtifact... artifacts) { installArtifacts(Arrays.asList(artifacts)); } @@ -648,7 +648,7 @@ public abstract class AbstractSession implements InternalSession { * @see ArtifactInstaller#install(Session, Collection) */ @Override - public void installArtifacts(Collection artifacts) { + public void installArtifacts(Collection artifacts) { getService(ArtifactInstaller.class).install(this, artifacts); } @@ -659,7 +659,7 @@ public abstract class AbstractSession implements InternalSession { * @see ArtifactDeployer#deploy(Session, RemoteRepository, Collection) */ @Override - public void deployArtifact(RemoteRepository repository, Artifact... artifacts) { + public void deployArtifact(RemoteRepository repository, ProducedArtifact... artifacts) { getService(ArtifactDeployer.class).deploy(this, repository, Arrays.asList(artifacts)); } diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultArtifactDeployer.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultArtifactDeployer.java index 83f06eb6d4..c0d29fffe1 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultArtifactDeployer.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/DefaultArtifactDeployer.java @@ -20,7 +20,7 @@ package org.apache.maven.internal.impl; import java.util.Collection; -import org.apache.maven.api.Artifact; +import org.apache.maven.api.ProducedArtifact; import org.apache.maven.api.RemoteRepository; import org.apache.maven.api.annotations.Nonnull; import org.apache.maven.api.di.Named; @@ -44,7 +44,7 @@ public class DefaultArtifactDeployer implements ArtifactDeployer { public void deploy(@Nonnull ArtifactDeployerRequest request) { nonNull(request, "request"); InternalSession session = InternalSession.from(request.getSession()); - Collection artifacts = nonNull(request.getArtifacts(), "request.artifacts"); + Collection artifacts = nonNull(request.getArtifacts(), "request.artifacts"); RemoteRepository repository = nonNull(request.getRepository(), "request.repository"); try { DeployRequest deployRequest = new DeployRequest() diff --git a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/InternalSession.java b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/InternalSession.java index 7d51b36e75..df69c19f1b 100644 --- a/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/InternalSession.java +++ b/impl/maven-impl/src/main/java/org/apache/maven/internal/impl/InternalSession.java @@ -77,7 +77,7 @@ public interface InternalSession extends Session { org.eclipse.aether.graph.Dependency toDependency(DependencyCoordinates dependency, boolean managed); - List toArtifacts(Collection artifacts); + List toArtifacts(Collection artifacts); org.eclipse.aether.artifact.Artifact toArtifact(Artifact artifact);