[
https://issues.apache.org/jira/browse/MNG-5948?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763544#comment-17763544
]
Emmanuel Lécharny edited comment on MNG-5948 at 9/11/23 4:29 AM:
-----------------------------------------------------------------
Hi,
still, I don't think it's consistant. I was figthing the same problem at Apache
Directory project, where we have:
```
{color:#646464}@{color}{color:#646464}Parameter{color}{color:#000000}(property
= {color}{color:#2a00ff}"installers.dpkg"{color}{color:#000000}, defaultValue =
{color}{color:#2a00ff}"/usr/bin/dpkg"{color}{color:#000000}){color}
{color:#7f0055}private{color}{color:#000000} File
{color}{color:#0000c0}dpkgUtility{color}{color:#000000};{color}
```
and that kind of configuration does not work:
```
<{color:#268bd2}plugin{color}>
<{color:#268bd2}groupId{color}>${project.groupId}</{color:#268bd2}groupId{color}>
<{color:#268bd2}artifactId{color}>apacheds-installers-maven-plugin</{color:#268bd2}artifactId{color}>
<{color:#268bd2}configuration{color}>
{color:#93a1a1} <dpkg>/usr/local/bin/dpkg</dpkg>{color}
```
(I had to change it to <dpkgUtility>...</dpkgUtility> to get it working)
while ```mvn clean install -Pdebian -Dinstallers.dpkg=/usr/local/bin/dpkg```
works.
What the point in allowing a 'property' being defined if it can't be used in
the pom.xml configuation file? It's really confusing...
was (Author: elecharny):
Hi,
still, I don't think it's consistant. I was figthing the same problem at Apache
Directory project, where we have:
```
{color:#646464}@{color}{color:#646464}Parameter{color}{color:#000000}(property
= {color}{color:#2a00ff}"installers.dpkg"{color}{color:#000000}, defaultValue =
{color}{color:#2a00ff}"/usr/bin/dpkg"{color}{color:#000000}){color}
{color:#7f0055}private{color}{color:#000000} File
{color}{color:#0000c0}dpkgUtility{color}{color:#000000};{color}
```
and that kind of configuration does not work:
```
<{color:#268bd2}plugin{color}>
<{color:#268bd2}groupId{color}>${project.groupId}</{color:#268bd2}groupId{color}>
<{color:#268bd2}artifactId{color}>apacheds-installers-maven-plugin</{color:#268bd2}artifactId{color}>
<{color:#268bd2}configuration{color}>
{color:#93a1a1} <dpkg>/usr/local/bin/dpkg</dpkg>{color}
```
while ```mvn clean install -Pdebian -Dinstallers.dpkg=/usr/local/bin/dpkg```
works.
What the point in allowing a 'property' being defined if it can't be used in
the pom.xml configuation file? It's really confusing...
> Parameter values are only injected from plugin configuration if the config
> value is identical to variable names.
> ----------------------------------------------------------------------------------------------------------------
>
> Key: MNG-5948
> URL: https://issues.apache.org/jira/browse/MNG-5948
> Project: Maven
> Issue Type: Bug
> Components: Core
> Affects Versions: 3.3.3
> Reporter: Krzysztof Trojan
> Priority: Major
> Attachments: param-issue-demo-maven-plugin.zip
>
>
> In Maven 3.3.x it was observed that the Mojo field, being a parameter
> (annotated @Parameter either in Javadoc or in Java annotation), is only
> injected a value if in configuration a property is given with the exact same
> name. The "property" attribute of the @Parameter annotation seems not to make
> to read the value from a property named in the attribute.
> Example:
> {code}
> @Mojo( name = "something" )
> public class ExampleMojo extends AbstractMojo
> {
> @Parameter( property = "propertyIWant" )
> private String myParam;
> // truncated
> {code}
> does inject anything into myParam from a pom.xml with the config below in the
> plugin configuration:
> {code:xml}
> <configuration>
> <propertyIWant>something to inject</propertyIWant>
> </configuration>
> {code}
> While:
> {code:xml}
> <configuration>
> <myParam>something to inject</myParam>
> </configuration>
> {code}
> works nicely.
> This is regression comparing to Maven 3.0.x, where the same plugin works and
> gets values from the config entry named as in @Parameter(property)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)