slachiewicz opened a new issue, #13305:
URL: https://github.com/apache/maven/issues/13305

   ### Affected version
   
   4.0.0-rc-7; unchanged on `master` and `maven-4.0.x`.
   
   ### Bug description
   
   A mojo parameter of type `org.apache.maven.api.xml.XmlNode` loses every XML 
attribute of its configuration. Given
   
   ```xml
   <configuration>
     <target>
       <echo message="hello"/>
     </target>
   </configuration>
   ```
   
   the injected `XmlNode` has an `echo` child with no `message` attribute.
   
   Cause: 
[`DefaultBeanConfigurator.XmlConverter.toXml`](https://github.com/apache/maven/blob/master/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/DefaultBeanConfigurator.java)
 builds each node with `XmlNode.newInstance(name, value, null, children, 
null)`, so the attributes argument is always `null`; 
`PlexusConfiguration.getAttributeNames()` is never read. The converter is the 
one `EnhancedConverterLookup` registers for mojo configuration, added in #1071.
   
   Found while porting maven-antrun-plugin and maven-checkstyle-plugin to the 
Maven 4 API (#13302): antrun's `<target>` and checkstyle's `<checkstyleRules>` 
both carry attributes. Both ports work around it by reading 
`MojoExecution.getConfiguration()` instead. Passing the configuration's 
attributes to `XmlNode.newInstance` should fix it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to