maven-mvnd
maven-mvnd copied to clipboard
Provide a mechanism to exclude building specific modules in parallel
This could be very handy in case you have integration tests modules that do share some external resource. This would require some kind of lock exclusion, similar to the junit annotation https://junit.org/junit5/docs/5.7.2/api/org.junit.jupiter.api/org/junit/jupiter/api/parallel/ResourceLock.html . However, I think we may have several forked JVMs in parallel in these cases, so a simple lock would not work... A simple workaround would be add some dependencies at test scope between the ITs so that they're never executed in parallel, but that's not as clean.
Yes, adding
<dependency>
<groupId>org.my-group</groupId>
<artifactId>B</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
to C would make C always start building after B is fully built, which makes it a valid workaround for this problem.
It is true that this is not really easy to maintain in situations where the execution order actually does not matter and where there is many modules in the mutualy exclusive group.
For the tests use case, maybe the locking would suffice on the level of mojos rather than the whole modules?