Closed josephlbarnett closed 3 months ago
One possibility would be to modify this plugin's code and synchronize the compiler bridge installation. Have you tried this?
Have not tried due to the rarity of failures and the infrastructure setup of installing a modified plugin somewhere CI can access it, but probably could just make CompilerBridgeFactory.getCompiledBridgeJar
synchronized to try this?
Closed by #759
We have a somewhat large multi-module project using the scala-maven-plugin that we build with
-T 4
to parallelize and speed up the build process. Sometimes in CI, we get the following error on a random module (and rerunning tends to work successfully):We think what's happening is that multiple modules are attempting to compile the sbt-compiler-bridge jar and install it to ~/.sbt/1.0/zinc/org.scala-sbt, and when a later one finishes doing so, it replaces the jar that is in use by another module that's attempting to compile scala code having already referenced the existing jarfile. (in at least one failed run, 3 modules attempt and succeed in compiling and installing the bridge. Just before they do that installation, a 4th module logs out "Compiler bridge file is not installed yet" and starts to compile and install it again. Just as that module finishes installing the bridge, a separate module fails with the error above)
We've worked around this for now by adding an empty src/test/scala file in the parent pom-only module which forces the compiler bridge installation to happen before the child modules get threaded off, but would prefer not to need that ugly workaround.