In my case it was not working because the profile configuration was in a module pom.xml while the project just imported that module, apparently enabling the maven profile in the IntelliJ maven window doesn't enable for all modules, but only the main one,
it may work as expected if using maven reactor, instead of multiple poms that work independently but are interconnected adding them as dependency