maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hervé Boutemy (JIRA) <j...@apache.org>
Subject [jira] [Updated] (MNG-5440) default-value on mojo parameter of type collection or array effectively make parameter read-only
Date Thu, 13 Aug 2015 07:53:45 GMT

     [ https://issues.apache.org/jira/browse/MNG-5440?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Hervé Boutemy updated MNG-5440:
-------------------------------
    Description: 
If you use default-value on collection or array mojo parameters like

{code:java}
    /**
     * @parameter default-value="foo,bar"
     */
    private List<String> param1;
{code}

the default value will always win over pom.xml configuration.
See demo project attached.
Steps to reproduce:

1. {{mvn install}} on the demo project
2. {{mvn compile -f test-pom.xml -X -e}} on the demo project

you can see in the debug log that mojo configuration

{noformat}[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <param1 default-value="foo,bar">
    <param1>non-default value1 param1</param1>
    <param1>non-default value2 param1</param1>
  </param1>
  <param2 default-value="baz">
    <param2>non-default value1 param2</param2>
    <param2>non-default value2 param2</param2>
  </param2>
</configuration>{noformat}

will not be aplied correctly:

{noformat}[DEBUG] Configuring mojo 'mojoParamsBug:mojoParamsBug:0.0.1-SNAPSHOT:demo' with
basic configurator -->
[DEBUG]   (f) param1 = [foo, bar]
[DEBUG]   (f) param2 = [baz]
[DEBUG] -- end configuration --
[INFO] param1: [foo, bar]
[INFO] param2: [baz]{noformat}


If default values for srrays/collection are not supported, this should fail the build in step
1. above.
If they are supported, the configurator should be fixed to actually allow configuring non-default
values.


  was:
If you use default-value on collection or array mojo parameters like

{code}
    /**
     * @parameter default-value="foo,bar"
     */
    private List<String> param1;
{code}

the default value will always win over pom.xml configuration.
See demo project attached.
Steps to reproduce:

1. {{mvn install}} on the demo project
2. {{mvn compile -f test-pom.xml -X -e}} on the demo project

you can see in the debug log that mojo configuration

[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <param1 default-value="foo,bar">
    <param1>non-default value1 param1</param1>
    <param1>non-default value2 param1</param1>
  </param1>
  <param2 default-value="baz">
    <param2>non-default value1 param2</param2>
    <param2>non-default value2 param2</param2>
  </param2>
</configuration>

will not be aplied correctly:

[DEBUG] Configuring mojo 'mojoParamsBug:mojoParamsBug:0.0.1-SNAPSHOT:demo' with basic configurator
-->
[DEBUG]   (f) param1 = [foo, bar]
[DEBUG]   (f) param2 = [baz]
[DEBUG] -- end configuration --
[INFO] param1: [foo, bar]
[INFO] param2: [baz]


If default values for srrays/collection are not supported, this should fail the build in step
1. above.
If they are supported, the configurator should be fixed to actually allow configuring non-default
values.



> default-value on mojo parameter of type collection or array effectively make parameter
read-only
> ------------------------------------------------------------------------------------------------
>
>                 Key: MNG-5440
>                 URL: https://issues.apache.org/jira/browse/MNG-5440
>             Project: Maven
>          Issue Type: Bug
>            Reporter: Jan Sievers
>             Fix For: Issues to be reviewed for 4.x
>
>         Attachments: mojoParamsBug.zip
>
>
> If you use default-value on collection or array mojo parameters like
> {code:java}
>     /**
>      * @parameter default-value="foo,bar"
>      */
>     private List<String> param1;
> {code}
> the default value will always win over pom.xml configuration.
> See demo project attached.
> Steps to reproduce:
> 1. {{mvn install}} on the demo project
> 2. {{mvn compile -f test-pom.xml -X -e}} on the demo project
> you can see in the debug log that mojo configuration
> {noformat}[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
> <configuration>
>   <param1 default-value="foo,bar">
>     <param1>non-default value1 param1</param1>
>     <param1>non-default value2 param1</param1>
>   </param1>
>   <param2 default-value="baz">
>     <param2>non-default value1 param2</param2>
>     <param2>non-default value2 param2</param2>
>   </param2>
> </configuration>{noformat}
> will not be aplied correctly:
> {noformat}[DEBUG] Configuring mojo 'mojoParamsBug:mojoParamsBug:0.0.1-SNAPSHOT:demo'
with basic configurator -->
> [DEBUG]   (f) param1 = [foo, bar]
> [DEBUG]   (f) param2 = [baz]
> [DEBUG] -- end configuration --
> [INFO] param1: [foo, bar]
> [INFO] param2: [baz]{noformat}
> If default values for srrays/collection are not supported, this should fail the build
in step 1. above.
> If they are supported, the configurator should be fixed to actually allow configuring
non-default values.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message