ascheman commented on PR #11505:
URL: https://github.com/apache/maven/pull/11505#issuecomment-3679077389

   > General question: I just realized that those changes are applied in the 
deprecated `org.apache.maven.project.DefaultProjectBuilder` class, which is 
supposed to be replaced by 
`org.apache.maven.internal.impl.DefaultProjectBuilder`. It is not clear to me 
however which one of these two classes is executed in practice during a Maven 
build.
   
   Good question! I investigated this and found that **both classes are 
executed**, but with a delegation pattern:
   
   The new Maven 4 API implementation 
(`org.apache.maven.internal.impl.DefaultProjectBuilder`) is essentially a thin 
wrapper that delegates all actual work to the deprecated 
`org.apache.maven.project.DefaultProjectBuilder`:
   
   ```java
   @Inject
   public DefaultProjectBuilder(org.apache.maven.project.ProjectBuilder 
builder) {
       this.builder = builder;
   }
   
   // In doBuild():
   res = builder.build(path.toFile(), req);
   ```
   
   So the deprecated class (where the PR #11505 changes are located) **is the 
one doing all the actual work** - model building, lifecycle injection, resource 
handling, dependency resolution, etc. The Maven 4 API implementation just 
converts request/response types and delegates.
   
   I also stumbled upon this architectural situation earlier but didn't want to 
raise it as a concern since I'm not deep enough into the overall design to 
judge whether this is intentional (transitional architecture) or something that 
should be addressed.
   
   The _deprecated_ marker seems to be about the interface/API level 
(`org.apache.maven.project.ProjectBuilder`), signaling that consumers should 
use the new Maven 4 API (`org.apache.maven.api.services.ProjectBuilder`). The 
implementation hasn't been migrated yet - the deprecated class remains the 
workhorse.
   
   Perhaps @gnodet can elaborate on this as he introduced the deprecation?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to