[ https://issues.apache.org/jira/browse/MNG-6278?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16149846#comment-16149846 ]
S L edited comment on MNG-6278 at 9/1/17 12:48 AM: --------------------------------------------------- Just as a side-node: The maven-surefire-plugin would be affected by this as well when using the configuration in [Skipping Tests](https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html#Skipping_Tests). However when defining an additional property and providing this property as argument for the plugin configuration like outlined in [Skipping by Default](https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html#Skipping_by_Default) everything starts working again as expected. Attached is another sample project where one can reproduce with the maven-surefire-plugin itself: > mvn clean package -PdemoConfigUnSet -DskipTests=true Tests are skipped as expected since configuration is NOT set > mvn clean package -PdemoConfigSet -DskipTests=true Test will be executed and fail since the Test available has an `Assert.fail` Also note that this issue has a limited impact on the surefire-plugin. The reason for this is that it uses as a configuration the value <skipTests> and via command line maven.test.skip and if you check closely the source code it actually ends up in two distinct parameters: * via configuration <skipTests> see https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L160 * via command line maven.test.skip see https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L178 In the end they check all possible ways to skip the plugin: https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java#L360 was (Author: thesnoozer): Just as a side-node: The maven-surefire-plugin would be affected by this as well when using the configuration in [Skipping Tests](https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html#Skipping_Tests). However when defining an additional property and providing this property as argument for the plugin configuration like outlined in [Skipping by Default](https://maven.apache.org/surefire/maven-surefire-plugin/examples/skipping-tests.html#Skipping_by_Default) everything starts working again as expected. Attached is another sample project where one can reproduce with the maven-surefire-plugin itself: > mvn clean package -PdemoConfigUnSet -DskipTests=true Tests are skipped as expected since configuration is NOT set > mvn clean package -PdemoConfigSet -DskipTests=true Test will be executed and fail since the Test available has an `Assert.fail` Also note that this issue has a limited impact on the surefire-plugin. The reason for this is that it uses as a configuration the value <skipTests> and via command line maven.test.skip and if you check closely the source code it actually two distinct parameters: * via configuration <skipTests> see https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L160 * via command line maven.test.skip see https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java#L178 In the end they check all possible ways to skip the plugin: https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java#L360 > property inside @Parameter-Annotation is being ignored if it is also set > inside the configuration of the Plugin > --------------------------------------------------------------------------------------------------------------- > > Key: MNG-6278 > URL: https://issues.apache.org/jira/browse/MNG-6278 > Project: Maven > Issue Type: Bug > Affects Versions: 3.2.5, 3.3.9, 3.5.0 > Reporter: S L > Priority: Critical > Attachments: SampleProject_v2.zip, SampleProject.zip > > > Hi I have a strange problem with a property definition inside an > @Parameter-Annotation. > Pretty much the configuration inside the plugin is as the following: > {code:java} > @Parameter(property = "maven.buildHelperMojo.skip", defaultValue = "false") > private boolean skip; > {code} > The original reference for this can be found here: > https://maven.apache.org/guides/plugin/guide-java-plugin-development.html#Parameters > Regardless whenever I define a value of this property inside the > configuration-tag of the plugin and also provide an option via the > commandline e.g. `-Dmaven.buildHelperMojo.skip=true` the value provided by > commandline is getting ignored. > I have attached a sample project where the issue can be reproduced with the > following: > > mvn clean install && mvn clean initialize -PdemoConfigSet > > -Dmaven.buildHelperMojo.skip=true > - doesn't work since it has the configuration-tag set > > mvn clean install && mvn clean initialize -PdemoConfigUnSet > > -Dmaven.buildHelperMojo.skip=true > - works as expected since it has the configuration-tag NOT set -- This message was sent by Atlassian JIRA (v6.4.14#64029)