[ 
https://issues.apache.org/jira/browse/MNG-8034?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17811809#comment-17811809
 ] 

Tamas Cservenak commented on MNG-8034:
--------------------------------------

Ok, it was me: this is defined as such (hence "affects" all Maven versions).

When you _configure_ something in parent, that cannot be overridden by user 
properties (that MAY provide value if no configuration present), but in this 
case explicit configuration (in parent) "wins".

Still, I consider this as "bad practice": configuring plugins in parent POMs 
should happen with caution, and leaving some options for parent POM users, 
hence indirection via property is "best practice" (define a project property 
with value you want, and use that in plugin configuration, instead to use final 
value).

Overriding these configurations are possible only in child POM plugin 
configuration section, so requires more work and is not dynamic anymore.

> User properties do not correctly override
> -----------------------------------------
>
>                 Key: MNG-8034
>                 URL: https://issues.apache.org/jira/browse/MNG-8034
>             Project: Maven
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.9.6, 4.0.0-alpha-12
>            Reporter: Tamas Cservenak
>            Priority: Major
>
> It seems that user properties are unable to correctly override in certain 
> cases. Am actually unsure is this Surefire or Maven Core issue at all.
> Setup:
>  * parent POM enlists surefire plugin in build/pluginMgmt and sets 
> configuration {{failIfNoTests=true}}
>  * child module uses surefire to execute tests
> Project set up like this is NOT BUILDABLE without tests.
> Reproducer: [https://github.com/cstamas/mng-8034]
> Steps:
>  * build the project from top: {{mvn clean package}} => OK (and UTs run)
>  * now try to build {{mvn clean package -Dtest=void}} => surefire fails, 
> tells to set {{-Dsurefire.failIfNoSpecifiedTests=false}}
>  * set it {{mvn clean package -Dtest=void 
> -Dsurefire.failIfNoSpecifiedTests=false}} => surefire fails, tells to set 
> {{-DfailIfNoTests=false}}
>  * set it {{mvn clean package -Dtest=void 
> -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false}} => surefire 
> fails, tells to set thing from step 3 (endless loop), basically the user 
> property we set in 3rd step is not detected at all?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to