I cannot reproduce. I have a "sandbox" profile defined in my ~/.m2/settings.xml
and the following command just works, without complains:
$ mvn -Dtest=AppTest -Psandbox test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3372129
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
...
While using an undefined profile generates the WARNING you're talking about:
$ mvn -Dtest=AppTest -Pfoo test
[INFO] Scanning for projects...
[WARNING]
Profile with id: 'foo' has not been activated.
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3372129
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
...
This begs the question: where is this profile defined?