Skip to content

Commit 82ebf69

Browse files
committed
Upgrade to Maven 4.0.0-beta-5
1 parent db88aa3 commit 82ebf69

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ under the License.
6969

7070
<properties>
7171
<javaVersion>17</javaVersion>
72-
<mavenVersion>4.0.0-beta-3</mavenVersion>
72+
<mavenVersion>4.0.0-beta-5-SNAPSHOT</mavenVersion>
7373

7474
<guiceVersion>6.0.0</guiceVersion>
7575
<mavenAntrunPluginVersion>${version.maven-antrun-plugin}</mavenAntrunPluginVersion>
@@ -83,8 +83,8 @@ under the License.
8383
<mavenSourcePluginVersion>${version.maven-source-plugin}</mavenSourcePluginVersion>
8484
<mavenSurefirePluginVersion>${version.maven-surefire}</mavenSurefirePluginVersion>
8585
<mavenWarPluginVersion>${version.maven-war-plugin}</mavenWarPluginVersion>
86-
<mavenPluginTestingVersion>4.0.0-beta-1</mavenPluginTestingVersion>
87-
<mavenResolverVersion>2.0.0-alpha-11</mavenResolverVersion>
86+
<mavenPluginTestingVersion>4.0.0-beta-2-SNAPSHOT</mavenPluginTestingVersion>
87+
<mavenResolverVersion>2.0.2</mavenResolverVersion>
8888
<mockitoVersion>5.12.0</mockitoVersion>
8989
<slf4jVersion>2.0.13</slf4jVersion>
9090
<version.plexus-xml>4.0.3</version.plexus-xml>

src/main/java/org/apache/maven/plugins/deploy/DeployFileMojo.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.util.regex.Pattern;
3535

3636
import org.apache.maven.api.Artifact;
37+
import org.apache.maven.api.ProducedArtifact;
3738
import org.apache.maven.api.RemoteRepository;
3839
import org.apache.maven.api.model.Model;
3940
import org.apache.maven.api.model.Parent;
@@ -277,7 +278,7 @@ public void execute() throws MojoException {
277278
List<Artifact> deployables = new ArrayList<>();
278279

279280
boolean isFilePom = classifier == null && "pom".equals(packaging);
280-
Artifact artifact = session.createArtifact(
281+
ProducedArtifact artifact = session.createProducedArtifact(
281282
groupId, artifactId, version, classifier, isFilePom ? "pom" : getExtension(file), packaging);
282283

283284
if (file.equals(getLocalRepositoryFile(artifact))) {
@@ -289,7 +290,8 @@ public void execute() throws MojoException {
289290
deployables.add(artifact);
290291

291292
if (!isFilePom) {
292-
Artifact pomArtifact = session.createArtifact(groupId, artifactId, version, "", "pom", null);
293+
ProducedArtifact pomArtifact =
294+
session.createProducedArtifact(groupId, artifactId, version, "", "pom", null);
293295
if (deployedPom != null) {
294296
artifactManager.setPath(pomArtifact, deployedPom);
295297
deployables.add(pomArtifact);
@@ -306,13 +308,15 @@ public void execute() throws MojoException {
306308
}
307309

308310
if (sources != null) {
309-
Artifact sourcesArtifact = session.createArtifact(groupId, artifactId, version, "sources", "jar", null);
311+
ProducedArtifact sourcesArtifact =
312+
session.createProducedArtifact(groupId, artifactId, version, "sources", "jar", null);
310313
artifactManager.setPath(sourcesArtifact, sources);
311314
deployables.add(sourcesArtifact);
312315
}
313316

314317
if (javadoc != null) {
315-
Artifact javadocArtifact = session.createArtifact(groupId, artifactId, version, "javadoc", "jar", null);
318+
ProducedArtifact javadocArtifact =
319+
session.createProducedArtifact(groupId, artifactId, version, "javadoc", "jar", null);
316320
artifactManager.setPath(javadocArtifact, javadoc);
317321
deployables.add(javadocArtifact);
318322
}
@@ -360,7 +364,7 @@ public void execute() throws MojoException {
360364
String extension = getExtension(file);
361365
String type = types.substring(ti, nti).trim();
362366

363-
Artifact deployable = session.createArtifact(
367+
ProducedArtifact deployable = session.createProducedArtifact(
364368
artifact.getGroupId(),
365369
artifact.getArtifactId(),
366370
artifact.getVersion().asString(),

src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.apache.maven.api.Artifact;
2727
import org.apache.maven.api.MojoExecution;
28+
import org.apache.maven.api.ProducedArtifact;
2829
import org.apache.maven.api.Project;
2930
import org.apache.maven.api.RemoteRepository;
3031
import org.apache.maven.api.di.Inject;
@@ -254,8 +255,8 @@ private void deploy(ArtifactDeployerRequest request) {
254255

255256
private ArtifactDeployerRequest createDeployerRequest() {
256257
ProjectManager projectManager = getProjectManager();
257-
Collection<Artifact> deployables = projectManager.getAllArtifacts(project);
258-
Collection<Artifact> attachedArtifacts = projectManager.getAttachedArtifacts(project);
258+
Collection<ProducedArtifact> deployables = projectManager.getAllArtifacts(project);
259+
Collection<ProducedArtifact> attachedArtifacts = projectManager.getAttachedArtifacts(project);
259260

260261
ArtifactManager artifactManager = getArtifactManager();
261262
if (artifactManager.getPath(project.getPomArtifact()).isEmpty()) {
@@ -292,7 +293,7 @@ private ArtifactDeployerRequest createDeployerRequest() {
292293
ArtifactDeployerRequest request = ArtifactDeployerRequest.builder()
293294
.session(session)
294295
.repository(getDeploymentRepository(session.isVersionSnapshot(project.getVersion())))
295-
.artifacts(deployables)
296+
.artifacts((Collection) deployables)
296297
.retryFailedDeploymentCount(Math.max(1, Math.min(10, getRetryFailedDeploymentCount())))
297298
.build();
298299

src/test/java/org/apache/maven/plugins/deploy/DeployMojoTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
import org.apache.maven.api.plugin.testing.InjectMojo;
3838
import org.apache.maven.api.plugin.testing.MojoParameter;
3939
import org.apache.maven.api.plugin.testing.MojoTest;
40-
import org.apache.maven.api.plugin.testing.stubs.ArtifactStub;
40+
import org.apache.maven.api.plugin.testing.stubs.ProducedArtifactStub;
4141
import org.apache.maven.api.plugin.testing.stubs.ProjectStub;
4242
import org.apache.maven.api.plugin.testing.stubs.SessionMock;
4343
import org.apache.maven.api.services.ArtifactDeployer;
@@ -158,7 +158,7 @@ public void testDeployWithAttachedArtifacts(DeployMojo mojo) throws Exception {
158158
Project project = (Project) getVariableValueFromObject(mojo, "project");
159159
projectManager.attachArtifact(
160160
project,
161-
new ArtifactStub("org.apache.maven.test", "attached-artifact-test", "", "1.0-SNAPSHOT", "jar"),
161+
new ProducedArtifactStub("org.apache.maven.test", "attached-artifact-test", "", "1.0-SNAPSHOT", "jar"),
162162
Paths.get(getBasedir(), "target/test-classes/unit/attached-artifact-test-1.0-SNAPSHOT.jar"));
163163
artifactManager.setPath(
164164
project.getMainArtifact().get(),
@@ -310,7 +310,8 @@ private Project createProject() {
310310
.url(Paths.get(getBasedir()).toUri().toString())
311311
.build())
312312
.build()));
313-
ArtifactStub jar = new ArtifactStub("org.apache.maven.test", "maven-deploy-test", "", "1.0-SNAPSHOT", "jar");
313+
ProducedArtifactStub jar =
314+
new ProducedArtifactStub("org.apache.maven.test", "maven-deploy-test", "", "1.0-SNAPSHOT", "jar");
314315
project.setMainArtifact(jar);
315316
return project;
316317
}

0 commit comments

Comments
 (0)