See issue in Micronaut repo here: micronaut-projects/micronaut-core#9526
Bug preventing app from being built. Reproduce by trying to build the app:
./gradlew clean build
Will yield the following unexpected error
> Task :main:compileJava FAILED
error: Unexpected error: Attempt to recreate a file for type com.example.$Application$MyService0$Definition$Reference
Note: Creating bean classes for 2 type elements
1 error
This is due to having more than 1 bean with the following conditions:
- They have the same name, but are in different packages.
- Need to be scanned by
@Import
annotation to be injected into dependent beans.
Changing any of the bean names from MyService
to anything else will make the build pass.