Flatten node configuration parameters
It's atypical to use nested tags for configuration parameters of a Maven plugin (i.e., a complex object). The main reason is that they aren't true mojo parameters. To start, they cannot be mapped to properties, which would allow them to be overridden from a profile or the command line. They also don't benefit from other parameter features such as default values. It's also more XML for the user to have to type.
Here's how the configuration currently looks:
<node>
<version>18</version>
<installDirectory>${basedir}</installDirectory>
</node>
Here's how it would look under this proposal:
<nodeVersion>18</nodeVersion>
<nodeInstallDirectory>${basedir}</nodeInstallDirectory>
Using flat parameters also makes it more clear where to put npm-related properties. If we used the nested structure, it might be:
<node>
<version>18</version>
<npmVersion>provided</npmVersion>
<npmRegistry>https://npm.example.org</npmRegistry>
</node>
However, it seems strange to have both a version
and npmVersion
property under the node property. It just looks clearer when flat:
<nodeVersion>18</nodeVersion>
<npmVersion>provided</npmVersion>
<npmRegistry>https://npm.example.org</npmRegistry>
The support for complex object parameters in Maven seems to be intended for when the object is an atomic parameter. Since we're using the node parameters to control different behaviors, they should not be grouped as a complex object.