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

Tamas Cservenak commented on MINSTALL-202:
------------------------------------------

Well, your "howerer..." paragraph is true not only for install, but for the 
whole project. As this comment suggests 
(https://github.com/mojohaus/versions/issues/1071#issuecomment-2109926461) the 
plugin is simply put "too late", your model is already built. Hence, 
{{$revision}} is there, everywhere.

Simply put your contribution to versions maven plugin, while it gets the needed 
info, and even puts it into (already built) project properties, is not enough, 
as model would need to be _fully rebuilt_ to take new property into account. 
Also, it goes against what is explained on this page as well: 
https://maven.apache.org/maven-ci-friendly.html The property MUST BE available 
ahead of time, is clearly explained there as well. When a plugin executes, it 
is already too late, as model was built, phases calculated, and then goal is 
invoked (but as I said, model was already built, so you'd somehow need to 
"trigger model rebuild", which is not possible in Maven).

> Version property is not expanded for destination path
> -----------------------------------------------------
>
>                 Key: MINSTALL-202
>                 URL: https://issues.apache.org/jira/browse/MINSTALL-202
>             Project: Maven Install Plugin
>          Issue Type: Bug
>          Components: install:install
>            Reporter: Jimisola Laursen
>            Priority: Major
>             Fix For: 3.1.3
>
>
> I recently [contributed|https://github.com/mojohaus/versions/issues/1071] the 
> goal 
> [versions:use-dynamic-version-from-scm|https://www.mojohaus.org/versions/versions-maven-plugin/use-dynamic-version-from-scm-mojo.html]
> to MojoHaus Versions Maven plugin with the help of [~sjaranowski] .
> The goal is to allow dynamic versioning using [Maven CI Friendly 
> Versions|https://maven.apache.org/maven-ci-friendly.html] by setting a 
> property (revision), i.e. 
> {code:java}
> <version>${revision}</version> {code}
> However, it turns out that 
> {code:java}
> ./mvnw 
> org.codehaus.mojo:versions-maven-plugin:2.17.1:use-dynamic-version-from-scm 
> install -useVersion=0.0.0{code}
> does not give the correct destination path but rather:
> /home/u30576/.m2/repository/se/lfv/lips3/microservices/ms001/${revision}/ms001-${revision}-spring-boot.jar
> as seen below.
>  
> {code:java}
> u30576@DCL0004:~/dev/clones/sysdev/lips3/microservices/ms001 (main)$./mvnw 
> org.codehaus.mojo:versions-maven-plugin:2.17.1:use-dynamic-version-from-scm 
> install -useVersion=0.0.0
> [INFO] ------------------< se.lfv.lips3.microservices:ms001 
> >------------------
> [INFO] Building ms001 ${revision}
> [INFO]   from pom.xml
> [INFO] --------------------------------[ jar 
> ]---------------------------------
> [INFO] 
> [INFO] --- versions:2.17.1:use-dynamic-version-from-scm (default-cli) @ ms001 
> ---
> [INFO] Property 'revision' set to: 0.0.0
> ...
> [INFO] --- jar:3.4.2:jar (default-jar) @ ms001 ---
> [INFO] Building jar: 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0.jar
> [INFO] 
> [INFO] --- javadoc:3.8.0:jar 
> (se.lfv.maven.tiles_lfv-development-environment-tile_0.2.11__attach-javadocs) 
> @ ms001 ---
> [INFO] Configuration changed, re-generating javadoc.
> [INFO] Building jar: 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0-javadoc.jar
> [INFO] 
> [INFO] --- spring-boot:3.3.2:repackage 
> (se.lfv.maven.tiles_spring-boot-application-tile_0.4.1__repackage) @ ms001 ---
> [INFO] Attaching repackaged archive 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0-spring-boot.jar
>  with classifier spring-boot
> [INFO] 
> [INFO] 
> [INFO] --- install:3.1.2:install (default-install) @ ms001 ---
> [INFO] Installing 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/pom.xml to 
> /home/u30576/.m2/repository/se/lfv/lips3/microservices/ms001/${revision}/ms001-${revision}.pom
> [INFO] Installing 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0.jar
>  to 
> /home/u30576/.m2/repository/se/lfv/lips3/microservices/ms001/${revision}/ms001-${revision}.jar
> [INFO] Installing 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0-javadoc.jar
>  to 
> /home/u30576/.m2/repository/se/lfv/lips3/microservices/ms001/${revision}/ms001-${revision}-javadoc.jar
> [INFO] Installing 
> /home/u30576/dev/clones/sysdev/lips3/microservices/ms001/target/ms001-0.0.0-spring-boot.jar
>  to 
> /home/u30576/.m2/repository/se/lfv/lips3/microservices/ms001/${revision}/ms001-${revision}-spring-boot.jar
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time:  6.410 s
> [INFO] Finished at: 2024-07-30T13:49:32+02:00
> [INFO] 
> ------------------------------------------------------------------------
>  
> {code}
>  
> I'm aware that Maven outputs "[INFO] Building ms001 ${revision}" initially 
> (before the plugin has run) but I reckon that _initialize_ is the correct 
> phase to execute the plugin in.
> Build Info:
> Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
> Maven home: /home/uXXXXX/.m2/wrapper/dists/apache-maven-3.9.8/d33422ce
> Java version: 21.0.1, vendor: Eclipse Adoptium, runtime: 
> /opt/dev/sdkman/candidates/java/21.0.1-tem
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "6.5.0-45-generic", arch: "amd64", family: "unix"
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to