I'm writing my own Maven plugin. My Mojo has a required parameter list:
@Parameter(property = "map.packages", required = true)
private List<String> packages;
Now, when I run this plugin in a project with no configuration, I would expect the build to fail as the packages parameter is required. Instead I get packages as an empty list.
Is this a bug or am I doing something wrong?
Ps. I probably should have added this to some issue tracker but where is Maven's issue tracker?
The problem is located based on the property which can be observed via a debug output (with the help of an integration test) which looks like this:
[DEBUG] -----------------------------------------------------------------------
[DEBUG] Goal: com.nitorcreations:drm-maven-plugin:1.1-SNAPSHOT:map (test-parameter)
[DEBUG] Style: Regular
[DEBUG] Configuration: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<outputDirectory default-value="${project.build.directory}">${outputDir}</outputDirectory>
<packages>${map.packages}</packages>
<project default-value="${project}"/>
</configuration>
Here you can see that the property (map.packages) will be injected into the package configuration parameter which means the configuration parameter has a value which fulfills the required parameter. If you need having a property defined in combination with required you need to check in the execute() method.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With