gnodet-bot commented on code in PR #13647:
URL: https://github.com/apache/maven/pull/13647#discussion_r4530010701


##########
api/maven-api-spi/src/main/java/org/apache/maven/api/spi/ProjectTransformer.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.maven.api.spi;
+
+import org.apache.maven.api.Project;
+import org.apache.maven.api.Session;
+import org.apache.maven.api.annotations.Consumer;
+import org.apache.maven.api.annotations.Experimental;
+import org.apache.maven.api.annotations.Nonnull;
+import org.apache.maven.api.annotations.ThreadSafe;
+import org.apache.maven.api.model.Model;
+import org.apache.maven.api.services.MavenException;
+
+/**
+ * Allows build extensions to transform project models after all reactor 
projects have been read
+ * and before the reactor is sorted for execution. This is the v4 API 
equivalent of
+ * {@code AbstractMavenLifecycleParticipant.afterProjectsRead()}.
+ * <p>
+ * Transformers are called in sequence for each reactor project; the model 
returned by one transformer
+ * is passed as input to the next. The final model is written back into the 
project by the runtime.
+ * <p>
+ * Implementations may return a modified model built via {@code 
Model.newBuilder(model)...build()},
+ * or return the input model unmodified for a no-op. Throwing aborts the build.
+ *
+ * @since 4.2.0
+ */
+@Experimental
+@Consumer
+@ThreadSafe

Review Comment:
   💡 **`@ThreadSafe` is unique to this SPI interface** — no other SPI in 
`maven-api-spi` carries this annotation (checked: `ModelParser`, 
`DependencyResolver`, `LanguageProvider`, `RepositoryFactory`, etc.). Either 
annotate all SPIs that have thread-safety guarantees, or document here why 
`ProjectTransformer` specifically must be thread-safe (e.g. parallel builds 
call it concurrently).



##########
impl/maven-core/src/main/java/org/apache/maven/lifecycle/internal/concurrent/BuildPlanExecutor.java:
##########
@@ -580,11 +583,15 @@ private void executeStep(BuildStep step) throws 
IOException, LifecycleExecutionE
                             failure = new LifecycleExecutionException("Error 
building project");
                             failures.forEach(failure::addSuppressed);
                         }
+                        List<MojoExecution> failedPlan = 
executionPlan(step.project);
+                        projectExecutionListener.afterProjectExecutionFailure(
+                                new ProjectExecutionEvent(session, 
step.project, failedPlan, failure));
                         handleBuildError(reactorContext, session, 
step.project, failure, isFatal(failures));

Review Comment:
   â„šī¸ **Ordering note**: here `afterProjectExecutionFailure` is called *before* 
`handleBuildError`. In `LifecycleModuleBuilder`, the order is reversed — 
`handleBuildError` runs first, then `afterProjectExecutionFailure`. If this 
asymmetry is intentional (e.g. the concurrent executor needs to notify before 
state mutation), a brief comment would help implementors of 
`ProjectExecutionListener` understand what reactor state to expect when the 
callback fires.



##########
impl/maven-core/src/main/java/org/apache/maven/internal/impl/DefaultProjectManager.java:
##########
@@ -73,6 +73,7 @@ public DefaultProjectManager(InternalMavenSession session, 
ArtifactManager artif
         this.artifactManager = artifactManager;
     }
 
+

Review Comment:
   🔧 Spurious blank line — this introduces a double blank line between the 
constructor's closing `}` and the `@Nonnull` annotation. Remove one.
   
   ```suggestion
   
       @Nonnull
   ```



-- 
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