List parameter in a mojo has strange behaviour
----------------------------------------------
Key: MNG-4551
URL: http://jira.codehaus.org/browse/MNG-4551
Project: Maven 2 & 3
Issue Type: Bug
Components: Plugins and Lifecycle
Affects Versions: 2.2.1
Environment: windows, maven 2.2.1, java 1.5.15, gmaven 1.0 rc4
Reporter: Gabriel Dogaru
I had different problems with a mojo parameter of type list in my Mojo.
I use a parent pom to configure all the plugins used in our projects.
There I give the list 4 values like this, and every module should be able to
overwrite this and use any dbs it needs.
<moduleDbs>
<moduleDb>metadata</moduleDb>
<moduleDb>portal</moduleDb>
<moduleDb>client</moduleDb>
<moduleDb>model</moduleDb>
</moduleDbs>
In my mojo I have
* @parameter
* @required
*/
List moduleDbs
1. If I try to use
* @parameter expression="${moduleDbs}"
it fails saying it can not initialize the list.
2.I tried to overwrite the configuration in a module with an empty db set.
tried both <moduleDbs/> and <moduleDbs></moduleDbs> but the mojo still had one
record in the list
Also I needed to overwrite it with a value that was not in the parent, like
<moduleDbs> <moduleDb>lolisima</moduleDb> </..
and the list also contained metadata from the original configuration.
When I switched the type from List to
* @parameter expression="${moduleDbs}"
* @required
*/
String[] moduleDbs
everything worked perfectly.
I am not sure if this has something to do with maven core. I am using gmaven
and it may be because of the way groovy treats arrays and lists.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira