[ 
http://jira.codehaus.org/browse/MNG-5030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=258043#action_258043
 ] 

Evgeny Goldin edited comment on MNG-5030 at 2/28/11 6:20 PM:
-------------------------------------------------------------

Sure. In my plugins I [don't 
like|http://evgeny-goldin.com/wiki/Maven-copy-plugin#.3Cconfiguration.3E] 
wrapping single tag with a plural option:

{code}
<configuration>
    <tags>
        <tag>data</tag>
    </tags>
</configuration>
{code}

When there is a single tag, one can specify it:

{code}
<configuration>
    <tag>data</tag>
</configuration>
{code}

I achieve this by 
[having|https://github.com/evgeny-goldin/maven-plugins/blob/0.2.1/maven-copy-plugin/src/main/groovy/com/goldin/plugins/copy/CopyMojo.groovy#L83]


{code}
String   tag
String[] tags
{code}

in my POJO and then 
[analyze|https://github.com/evgeny-goldin/maven-plugins/blob/0.2.1/maven-copy-plugin/src/main/groovy/com/goldin/plugins/copy/CopyMojo.groovy#L88]
 what was actually set. The problem begins when a user does a mistake and 
forgets to wrap multiple tags:


{code}
<configuration>
    <tag>data1</tag>
    <tag>data2/tag>
    <tag>data3</tag>
</configuration>
{code}

In this case Maven overrides each previous *{{<tag>}}* with the following one 
so in the end when *{{execute()}}* fires only *{{<tag>data3</tag>}}* is 
actually set while *{{<tag>data1</tag>}}* and *{{<tag>data2</tag>}}* are 
silently ignored.

If I had *{{<configuration>}}* XML I could check this case and throw an error.

In general, having _some_ way of injection control could be very helpful.

      was (Author: evgeny.goldin):
    Sure. In my plugins I 
[http://evgeny-goldin.com/wiki/Maven-copy-plugin#.3Cconfiguration.3E don't 
like] wrapping single tag with a plural option:

{code}
<configuration>
    <tags>
        <tag>data</tag>
    </tags>
</configuration>
{code}

When there is a single tag, one can specify it:

{code}
<configuration>
    <tag>data</tag>
</configuration>
{code}

I achieve this by 
[https://github.com/evgeny-goldin/maven-plugins/blob/0.2.1/maven-copy-plugin/src/main/groovy/com/goldin/plugins/copy/CopyMojo.groovy#L83
 having]


{code}
String   tag
String[] tags
{code}

in my POJO and then 
[https://github.com/evgeny-goldin/maven-plugins/blob/0.2.1/maven-copy-plugin/src/main/groovy/com/goldin/plugins/copy/CopyMojo.groovy#L88
 analyze] what was actually set. The problem begins when a user does a mistake 
and forgets to wrap multiple tags:


{code}
<configuration>
    <tag>data1</tag>
    <tag>data2/tag>
    <tag>data3</tag>
</configuration>
{code}

In this case Maven overrides each previous *{{<tag>}}* with the following one 
so in the end when *{{execute()}}* fires only *{{<tag>data3</tag>}}* is 
actually set while *{{<tag>data1</tag>}}* and *{{<tag>data2</tag>}}* are 
silently ignored.

If I had *{{<configuration>}}* XML I could check this case and throw an error.

In general, having _some_ way of injection control could be very helpful.
  
> Provide a way to get a raw <configuration> XML for plugin to read
> -----------------------------------------------------------------
>
>                 Key: MNG-5030
>                 URL: http://jira.codehaus.org/browse/MNG-5030
>             Project: Maven 2 & 3
>          Issue Type: New Feature
>          Components: Plugin API
>    Affects Versions: 3.0.2
>            Reporter: Evgeny Goldin
>
> As a plugin author I may need to read its *{{<configuration>}}* slightly 
> different than Maven does it. It would be very nice to get a raw XML as an 
> alternative to standard fields injection.

-- 
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

        

Reply via email to