maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S L (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MNG-6260) Inconsistency for dynamic property replacement while using Maven's Plugin Prefix Resolution
Date Thu, 25 Apr 2019 12:49:00 GMT

    [ https://issues.apache.org/jira/browse/MNG-6260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826030#comment-16826030
] 

S L commented on MNG-6260:
--------------------------

As far as I understand the comment, the {{deployMoyo}} with it's configuration is fully initialized
before it knows the 'right' {{sample.generated}} property (which somewhat makes sense).

I'm wondering if there would be a way to make the {{deployMoyo}} aware of the changed value
for {{sample.generated}}.

For a user perspective it is weird that running {{mvn com.test.plugins:testPlugin:deployMojo}}
somewhat generates the {{sample.generated}} property, but it's certainly not making it's
way into the {{deployMoyo}} since the configuration picked up the unchanged value.

 

A use-case where such feature could be needed is a plugin that extracts the git-commit-hash
from the repository and then should be used as a version configuration for sonar which actually
suggests using Maven's Plugin Prefix Resolution ([as per suggestion|https://docs.sonarqube.org/display/SCAN/Analyzing+with+SonarQube+Scanner+for+Maven#AnalyzingwithSonarQubeScannerforMaven-AnalyzingaMavenProject] use {{mvn
clean verify sonar:sonar}} which breaks {{<properties><sonar.projectVersion>${project.version}-${git.commit}</sonar.projectVersion></properties>}}).

Not sure if this would then be something that can only be fixed within maven.

> Inconsistency for dynamic property replacement while using Maven's Plugin Prefix Resolution
> -------------------------------------------------------------------------------------------
>
>                 Key: MNG-6260
>                 URL: https://issues.apache.org/jira/browse/MNG-6260
>             Project: Maven
>          Issue Type: Bug
>    Affects Versions: 3.3.9, 3.5.0
>            Reporter: S L
>            Priority: Major
>         Attachments: SampleProject.zip
>
>
> 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 
> {noformat}
> <some.exampleParameter>${sample.generated}</some.exampleParameter>
> {noformat}
> Observations:
> * When building with {noformat}mvn clean package{noformat} the injected Property {{sample.generated}}
will be printed by the Mojo as well as from antrun correctly.
> * When building with {noformat}mvn com.test.plugins:testPlugin:deployMojo{noformat} the
injected Property {{sample.generated}} will be printed by antrun correctly but will show up
as null for the mojo execution.
> * When building with {noformat}mvn com.test.plugins:testPlugin:buildInjectPropertyMojo
antrun:run com.test.plugins:testPlugin:deployMojo{noformat} 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 {noformat}mvn clean install{noformat}
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



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message