How to exclude a BOM import?

Is it possible to exclude a BOM import? I have a micronaut dependency and in some point in the dependency resolution it tries to resolve aws bom:

ModuleVersionNotFoundException: Could not find io.micronaut.aws:micronaut-aws-bom:3.1.1

I don’t use aws so im trying to exclude aws bom with the transitive dependencies, i tried with a global exclude:

configurations.all {
exclude group: ‘io.micronaut.aws’, module: ‘micronaut-aws-bom’
}

but it doesn’t work, is there a way to exclude/ignore BOM resolution?