Profiles are a feature that should be used
very sparingly. I have used them, for example, to make a POM that could build a WAR for either the
Tomcat or IBM iSeries WebSphere servers, since Tomcat doesn't have the full
JEE stack and therefore needed extra libraries in the product WAR. But in general,
you should be able to hand a cleaned Maven project to anyone anywhere on the planet, and armed with nothing more that the basic Maven system, a JDK and a live Internet connection and be able to build a fully-functional product from a single command.
I don't recall anything about how to filter source directories. That kind of stuff is what I historically did with Ant. Usually I have conditional dependencies in my profiles.
For details on Maven profiles, see
https://maven.apache.org/guides/introduction/introduction-to-profiles.html And note that the first paragraph in the topic is a warning about making projects non-portable.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.