maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Broyer <t.bro...@gmail.com>
Subject Re: [Help] Force maven[-surefire] to run in parallel
Date Wed, 15 Mar 2017 13:56:59 GMT
Hi,

On Wed, Mar 15, 2017 at 2:11 PM Luis Henrique de Souza Melo <
lhsm@cin.ufpe.br> wrote:

> Hi,
>
> I am a student at the Federal University of Pernambuco, and our group is
> having some issues with Maven to run some tests in a huge amount of
> projects.
>
> We plan to run all theses open-source projects tests in parallel and in
> sequential using its own maven. However, we cannot change every pom.xml
> from every module and/or project main pom.xml manually.
>
> Is there any way to force maven and/or surefire to run in parallel using a
> command line argument, like: mvn test --parallel 3 -fae
> Or even in sequential mode would help us like: mvn test --sequential -fae
>

All parallelism-related properties can be set using "user properties",
which means you can set them from the command line (if they haven't been
set explicitly in the POMs); e.g. for forkCount [1] you can call Maven as
"mvn -DforkCount=2 test" to set the forkCount property to 2. If the
properties have been set in the POM, if they have been set using a property
value (e.g. <forkCount>${some.property}</forkCount>) then you can override
the property from the command line (i.e. "mvn -Dsome.property=2 test"). If
the properties have been set with hard-coded values (e.g.
<forkCount>1</forkCount>) then you have no other choice than to edit the
POMs.

And then you can tell Maven to parallelize the build with -T.

Actually, everything seems to be described in the Surefire documentation [2]

[1]
https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#forkCount

[2]
https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message