You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/08/08 15:27:53 UTC
(maven-dist-tool) branch drop-maven-compat created (now 0c53ec0)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch drop-maven-compat
in repository https://gitbox.apache.org/repos/asf/maven-dist-tool.git
at 0c53ec0 Replace MavenProjectBuilder with ProjectBuilder and drop maven-compat
This branch includes the following new commits:
new 0c53ec0 Replace MavenProjectBuilder with ProjectBuilder and drop maven-compat
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(maven-dist-tool) 01/01: Replace MavenProjectBuilder with ProjectBuilder and drop maven-compat
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch drop-maven-compat
in repository https://gitbox.apache.org/repos/asf/maven-dist-tool.git
commit 0c53ec0c7eb80a3a1f04f3a38feaa3f2617fda76
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Sat Aug 8 17:27:48 2026 +0200
Replace MavenProjectBuilder with ProjectBuilder and drop maven-compat
MavenProjectBuilder is the Maven 2 interface and lives only in
maven-compat; ProjectBuilder in maven-core does the same job. There was
one call site.
buildFromRepository(artifact, remoteRepos, localRepo, false) becomes
build(artifact, false, request), which keeps the same allowStubModel
argument, with the repositories moved onto a ProjectBuildingRequest
derived from the session so it inherits the repository session, offline
mode and the rest. setProcessPlugins(false) preserves the old behaviour,
which never processed plugins for these reads.
The session parameter is new; the mojo had no reason to hold one before.
ArtifactFactory stays: despite the name it lives in maven-core, not
maven-compat.
---
pom.xml | 6 ------
.../maven/dist/tools/site/DistCheckSiteReport.java | 16 +++++++++++++---
2 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/pom.xml b/pom.xml
index c73f6d7..d27409d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,12 +102,6 @@
<version>${mvnversion}</version>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-compat</artifactId>
- <version>${mvnversion}</version>
- <scope>provided</scope>
- </dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-repository-metadata</artifactId>
diff --git a/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java b/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
index cca1637..cbb112c 100644
--- a/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
+++ b/src/main/java/org/apache/maven/dist/tools/site/DistCheckSiteReport.java
@@ -29,11 +29,14 @@ import org.apache.maven.dist.tools.AbstractDistCheckReport;
import org.apache.maven.dist.tools.ConfigurationLineInfo;
import org.apache.maven.dist.tools.JsoupRetry;
import org.apache.maven.doxia.sink.Sink;
+import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugins.annotations.Component;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.MavenProjectBuilder;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.reporting.MavenReportException;
import org.jsoup.HttpStatusException;
import org.jsoup.nodes.Document;
@@ -75,7 +78,10 @@ public class DistCheckSiteReport extends AbstractDistCheckReport {
* Maven project builder.
*/
@Component
- protected MavenProjectBuilder mavenProjectBuilder;
+ protected ProjectBuilder projectBuilder;
+
+ @Parameter(defaultValue = "${session}", readonly = true, required = true)
+ protected MavenSession session;
/**
* Http status ok code.
@@ -227,8 +233,12 @@ public class DistCheckSiteReport extends AbstractDistCheckReport {
results.add(result);
try {
Artifact artifact = artifactFactory.createProjectArtifact(cli.getGroupId(), cli.getArtifactId(), version);
+ ProjectBuildingRequest request = new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
+ request.setRemoteRepositories(artifactRepositories);
+ request.setLocalRepository(localRepository);
+ request.setProcessPlugins(false);
MavenProject artifactProject =
- mavenProjectBuilder.buildFromRepository(artifact, artifactRepositories, localRepository, false);
+ projectBuilder.build(artifact, false, request).getProject();
String siteUrl = sites.get(cli.getArtifactId());
if (siteUrl == null) {