How to allow maven to run one test class with a non-default profile enabled?

I am trying to allow maven to run one test class, but I need to use an additional profile (which is actually already created). Usually when I run:

mvn clean install -PmyProfile

"myProfile" is activated. So I tried:

mvn -Dtest = test myTest -PmyProfile

As a result, "[WARNING] Profile with id: 'myProfile' is not activated.

What am I doing wrong and how can I achieve my goal?

+3
source share
1 answer

. "", ~/.m2/settings.xml, , :

$ mvn -Dtest=AppTest -Psandbox test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Q3372129
[INFO]    task-segment: [test]
[INFO] ------------------------------------------------------------------------
...

undefined , :

$ 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] ------------------------------------------------------------------------
...

: ?

+2

Source: https://habr.com/ru/post/1757352/


All Articles