'Parameter priority in pom.xml is higher than the one in argline

When I set testFailureIgnore parameter for maven-surefire-plugin in pom-file it overrides values from command line.

When i do like this

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
                <configuration>
                    <testFailureIgnore>false</testFailureIgnore>
                    ....
                </configuration>
                .....
            </plugin>

then mvn install always fails.

mvn clean install -Dtest=AlwaysFailTest -Dmaven.test.failure.ignore=false     //BUILD FAILURE

mvn clean install -Dtest=AlwaysFailTest -Dmaven.test.failure.ignore=true      //BUILD FAILURE

If I remove testFailureIgnore parameter from the pom, then mvn results will following

mvn clean install -Dtest=AlwaysFailTest -Dmaven.test.failure.ignore=false     //BUILD FAILURE

mvn clean install -Dtest=AlwaysFailTest -Dmaven.test.failure.ignore=true      //BUILD SUCCESS

Is it correct behavior or I do something wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source