[ 
https://issues.apache.org/jira/browse/MNG-7476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17536727#comment-17536727
 ] 

ASF GitHub Bot commented on MNG-7476:
-------------------------------------

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


##########
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:
   Found it.  But that makes me wonder if we should display some more detailed 
infos about the aggregator mojo.  It may not be trivial to find it in the whole 
build.  Thoughts ?





> Display a warning when an aggregator mojo is lock other mojos executions
> ------------------------------------------------------------------------
>
>                 Key: MNG-7476
>                 URL: https://issues.apache.org/jira/browse/MNG-7476
>             Project: Maven
>          Issue Type: Improvement
>    Affects Versions: 3.8.5
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 3.8.6, 3.9.0, 4.0.0-alpha-1, 4.0.0
>
>




--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to