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

Guillaume Boué commented on MNG-6117:
-------------------------------------

The {{parallel}} flag is indeed never set to {{true}} when the build is done in 
parallel.

However, there is a special consideration: the current 
[{{MultiThreadedBuilder}}|http://maven.apache.org/components/ref/3.3.9/maven-core/apidocs/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.html]
 will only build in parallel when the degree of concurrency (determined with 
{{-T}}) is at least 2, and when there are at least 2 projects to build. So 
running {{mvn help:evaluate -T 3}} on a single project (like the stub project) 
will still build the project with just 1 thread. In this case, which is the 
example in the description, I think {{session.parallel}} should still return 
{{false}} (and not {{true}} like Maven 3.0.5 does, in the given example): even 
though {{-T 3}} was set, it is ignored and only one thread is going to be used, 
resulting is a sequential, and not parallel, build.

To me, the fix here is to have {{session.parallel}} set to {{true}} when more 
than 1 thread are actually used to build. {{MultiThreadedBuilder}} does not 
clearly document the number of threads used, but if we agree on this, I'll also 
add it to reflect that.

> ${session.parallel} not correctly set
> -------------------------------------
>
>                 Key: MNG-6117
>                 URL: https://issues.apache.org/jira/browse/MNG-6117
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.3.9
>            Reporter: Richard Raumberger
>
> Running {{mvn help:evaluate -T 3}} and resolving the property  
> {{session.parallel}} returns {{true}} when run with Maven 3.0.5.
> When running it with 3.3.9, this property resolves to {{false}}.
> {code}
> mvn help:evaluate -T 3
> [INFO] Scanning for projects...
> [INFO]
> [INFO] Using the MultiThreadedBuilder implementation with a thread count of 3
> [INFO]
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Building Maven Stub Project (No POM) 1
> [INFO] 
> ------------------------------------------------------------------------
> [INFO]
> [INFO] --- maven-help-plugin:2.2:evaluate (default-cli) @ standalone-pom ---
> [INFO] No artifact parameter specified, using 
> 'org.apache.maven:standalone-pom:pom:1' as project.
> [INFO] Enter the Maven expression i.e. ${project.groupId} or 0 to exit?:
> ${session.parallel}
> [INFO]
> false
> {code}
> E.g. Surefire 
> [relies|https://github.com/apache/maven-surefire/blob/fb9b699e27dae905393a5bc4d5c6ae39606c3172/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L658]
>  on this property, to check whether Maven is running in parallel mode, as 
> mentioned in the comments of 
> [SUREFIRE-1301|https://issues.apache.org/jira/browse/SUREFIRE-1301].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to