Parallel build conflicts with annotation processor?

Hello!

I am currently working on a project migration from Maven to Gradle 6.5.1 (I’m a Gradle newbie). Overall the migration seems complete, so I wanted to try on the parallel execution. It seems to indeed increase the performances, but at the same time it is sometime failing because of this kind of error:

C:\path\to\prject\rest\impl\build\generated\sources\annotationProcessor\java\main\path\to\file\mapper\MyMapperImpl.java:30: error: reached end of file while parsing
        myClass.myMethod();

So it seems that Gradle initiates the Java compilation of all the source sets before the MapStruct annotation processor finishes its process (if I check the generated source file right after the build failure, the file is valid).

I would have assumed that Gradle would notice somehow that there is an annotation processor and waits for its completion (but I may be wrong here of course). So I see 2 options:

  • Either the Maptstruct annotation processor does not support the parallel mode (but I cannot find any reference to that on their documentation)
  • Or I need to state explicitly somehow in the build.gradle that the compilation of the sources dependsOn the annotation processor generation

Any idea on what is the right option (albeit there may be other options)? In case of the second one, how to achieve that?

Thanks

Any idea on this? Thanks!