[
https://issues.apache.org/jira/browse/MNG-8211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17875786#comment-17875786
]
Tamas Cservenak edited comment on MNG-8211 at 8/22/24 9:36 AM:
---------------------------------------------------------------
[~sjaranowski] That use case ("prepare value by a plugin") is violation of CI
Friendly Versions as documented here:
https://maven.apache.org/maven-ci-friendly.html
The documentation _clearly states_ that property MUST exists (either in project
properties or in user properties set with CLI {{-Dxxx=xxx}} or maven.config).
But in essence, what happens: when Maven session starts, after effective models
are built, it is too late for any plugin to kick in, set a property, whatever,
as in memory effective model will still have {{project.version=${prop}}} in
place. Whatever any plugin does later, it does NOT change effective model, and
just like in in MINSTALL-202 misunderstanding, it is NOT the job of
m-install-p to "interpolate" the version! If that would be so, EVERY PLUGIN
would need to re-evaluate effective model at every mojo execution as any
_previous_ plugin could injected some new property, and this is NOT how Maven
works.
(note that current "CI Friendly" implementation still does not do anything with
POM file, hence when you use it, you cannot use simple install/deploy plugins,
but you must "rewrite" the POM as documented using flatten or some alike
plugin!)
The CI Friendly documentation clearly states: the property must be available
beforehand: either as project property or as user property.
was (Author: cstamas):
[~sjaranowski] That use case ("prepare value by a plugin") is violation of CI
Friendly Versions as documented here:
https://maven.apache.org/maven-ci-friendly.html
The documentation _clearly states_ that property MUST exists (either in project
properties or is user properties set with CLI {{-Dxxx=xxx}} or maven.config).
But in essence, what happens: when Maven session starts, after effective models
are built, it is too late for any plugin to kick in, set a property, whatever,
as in memory effective model will still have {{project.version=${prop}}} in
place. Whatever any plugin does later, it does NOT change effective model, and
just like in in MINSTALL-202 misunderstanding, it is NOT the job of
m-install-p to "interpolate" the version! If that would be so, EVERY PLUGIN
would need to re-evaluate effective model at every mojo execution as any
_previous_ plugin could injected some new property, and this is NOT how Maven
works.
(note that current "CI Friendly" implementation still does not do anything with
POM file, hence when you use it, you cannot use simple install/deploy plugins,
but you must "rewrite" the POM as documented using flatten or some alike
plugin!)
The CI Friendly documentation clearly states: the property must be available
beforehand: either as project property or as user property.
> Maven should fail builds that use CI Friendly versions but have no values set
> -----------------------------------------------------------------------------
>
> Key: MNG-8211
> URL: https://issues.apache.org/jira/browse/MNG-8211
> Project: Maven
> Issue Type: Bug
> Components: Core
> Reporter: Tamas Cservenak
> Priority: Major
> Fix For: 4.0.0, 4.0.0-beta-4, 3.9.10
>
>
> As otherwise it is just source of confusion, Maven will "happily" install and
> deploy artifacts as {{G:A:$revision}} and this is 100% NOT what users wants.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)