You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2022/05/13 14:59:27 UTC

[GitHub] [maven] gnodet commented on a diff in pull request #736: [3.8.x] [MNG-7476] Display a warning when an aggregator mojo is lock other mojos executions

gnodet commented on code in PR #736:
URL: https://github.com/apache/maven/pull/736#discussion_r872493501


##########
maven-core/src/main/java/org/apache/maven/lifecycle/internal/MojoExecutor.java:
##########
@@ -232,7 +237,17 @@ private static class ProjectLock implements AutoCloseable
                 boolean aggregator = mojoDescriptor.isAggregator();
                 acquiredAggregatorLock = aggregator ? aggregatorLock.writeLock() : aggregatorLock.readLock();
                 acquiredProjectLock = getProjectLock( session );
-                acquiredAggregatorLock.lock();
+                if ( !acquiredAggregatorLock.tryLock() )
+                {
+                    for ( String s : MessageHelper.formatWarning(
+                            "An aggregator Mojo is already executing in parallel build, but aggregator "
+                                    + "Mojos require exclusive access to reactor to prevent race conditions. This "
+                                    + "mojo execution will be blocked until the aggregator work is done." ) )
+                    {

Review Comment:
   Right, I'll dig it.



-- 
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: issues-unsubscribe@maven.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org