apache / apache/maven

[MNG-6260] Inconsistency for dynamic property replacement while using Maven's Plugin Prefix Resolution

Open
#7,602 5 comments 0 reactions 0 assignees View on GitHub
bug priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[S L](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=thesnoozer)** opened **[MNG-6260](https://issues.apache.org/jira/browse/MNG-6260?redirect=false)** and commented

Hi,
I recently discovered a strange behaviour dynamic property replacement while using Maven's Plugin Prefix Resolution.
The original cause was reported to a project that I currently maintain and basically extract's repository information from git and inject them back as properties into the maven project.
The original report was that one if generated properties does not get resolved when it is getting used as a configuration parameter while executing ??mvn appengine:deploy??.

To be able to reproduce the issue I crafted a sample project that contain's of two Mojo's to simulate this behaviour.
* The first Mojo `BuildInjectPropertyMojo` will inject a Property `sample.generated` to the Maven project
* The second Mojo `DeployMojo` basically takes an arbitrary argument and prints it to the console. To reproduce the issue the Parameter needs to defined as followed

```
${sample.generated}
```

Observations:
* When building with ```
mvn clean package
``` the injected Property `sample.generated` will be printed by the Mojo as well as from antrun correctly.
* When building with ```
mvn com.test.plugins:testPlugin:deployMojo
``` the injected Property `sample.generated` will be printed by antrun correctly but will show up as null for the mojo execution.
* When building with ```
mvn com.test.plugins:testPlugin:buildInjectPropertyMojo antrun:run com.test.plugins:testPlugin:deployMojo
``` he injected Property `sample.generated` will be printed by the Mojo as well as from antrun correctly.

To use the attached example one need to install it first ```
mvn clean install
``` and remove the comments inside the pom.xml that are annotated with `COMMENT THIS IN TO REPRODUCE`

Please note that the execution of `mvn appengine:deploy` is per offical guideline of this tool:
https://cloud.google.com/appengine/docs/standard/java/tools/using-maven#deploying_your_application

---

**Affects:** 3.3.9, 3.5.0

**Attachments:**
- [SampleProject.zip](https://issues.apache.org/jira/secure/attachment/12877143/SampleProject.zip) (_4.30 kB_)

1 votes, 5 watchers

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.