Module conflicts when loading gradle project into Intellij

When loading a gradle project into Intellij it is failing with the error:
A conflict was found between the following modules:
- org.apache.avro:avro:1.7.7
- org.apache.avro:avro:1.8.1
Run with:
–scan or
:Prism:dependencyInsight --configuration runtimeClasspath --dependency org.apache.avro:avro
to get more insight on how to solve the conflict.

When running ‘gradle projects’ or gradle compileTestJava outside IntelliJ (via command line) it works. When running ‘gradle distTar’ via the command line it fails with the same error.

Does anyone know why this failure happens at different points inside and outside Intellij?