Maven: Как мне активировать профиль из командной строки?

Это фрагмент моего pom.xml. Я попробовал следующее, но профиль не был активирован.

mvn clean install -Pdev1
mvn clean install -P dev1

Когда я пыталсяmvn help:active-profiles никакие профили не были перечислены как активные. Если я установлю<activeByDefault> заdev1 вtrueи запуститьmvn help:active-profilesпоказывает, что профиль активирован.

<profile>
        <id>dev1</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <env>local</env>
                            <properties.file>src/test/resources/dev1.properties</properties.file>
                        </systemPropertyVariables>
                        <suiteXmlFiles>
                            <suiteXmlFile>src/test/resources/dev1.testng.xml</suiteXmlFile>
                        </suiteXmlFiles>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>dev2</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <systemPropertyVariables>
                            <env>local</env>
                            <properties.file>src/test/resources/dev2.properties</properties.file>
                        </systemPropertyVariables>
                        <suiteXmlFiles>
                            <suiteXmlFile>src/test/resources/dev2.testng.xml</suiteXmlFile>
                        </suiteXmlFiles>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    </profile>

Мне интересно, почему мой профиль не активируется. Кто-нибудь сталкивался с подобной проблемой?

Ответы на вопрос(4)

Ваш ответ на вопрос