maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Heinz Marbaise <khmarba...@gmx.de>
Subject Re: Special <version> parameters - sha1
Date Tue, 14 Nov 2017 13:42:55 GMT
Hi,


I will give some more details cause I have created the docs / 
implementation and you mentioned my blog ;-)..


On 14/11/17 03:12, Eric B wrote:
> Following a long thread on this list, and a blog by khmarbaise (
> http://blog.soebes.de/blog/2017/04/02/maven-pom-files-without-a-version-in-it/),
> I'm still a little confused as to exactly what is allowed in the special
> version tags for a maven pom.
> 
> I know and realize that the 3 allowable tags are:
>   - ${revision}
>   - ${sha1}
>   - ${changelist}
> 
> However, from the thread and the blog, it seems that these properties
> cannot be dependent on any other properties.

Correct.
> 
> For example, this is fine:
>         <version>${revision}-${sha1}</version>
> where mvn is called with -Drevision=1.2.3 -Dsha1=1a2b3c4e
> 
> 
> However, based on the further docs at
> https://maven.apache.org/maven-ci-friendly.html, this design would fail:

which is not mentioned in the docs...

> 
> <version>${revision}-${sha1}</version>
> 
> <properties>
>       <sha1>${buildNumber}</sha1>
> </properties>
> 
> 
> and call it as -Drevision=1.2.3 -DbuildNumber=99999

The problem is simply that buildNumber is not correctly overwritten from 
command and not correctly handled duing the model reading / 
interpolation at the correct time within Maven Core at the moment...

At the moment this is only implemented for those special three 
properties...which already has performance impacts...which is also a 
reason not making that possible for all kind of properties...at the 
moment...

> 
> 
> Is anyone able to shed some light as to why this would be the case?  Why
> can a property not be used to compute on of the 3 special vars?
> 
> My use case is that I want to supply the build number to all my builds, but
> only append it to the version if a specific profile is enabled.  In my
> mind, it would be simple - make the sha1 property empty by default, and in
> my specific profile, set it to the buildnumber.   But based on my
> understanding, this would fail.
> 
> Is my only option in that case to design it as:
> 
> <version>${artifactVersion}</version>
> <properties>
>    <artifactVersion>${revision}</artifactVersion>
> </properties>
> 
> <profile>
>    <id>buildNumber</id>
>    <properties>
>       <artifactVersion>${revision}-${sha1}</artifactVersion>
>    </properties>
> </profile>
> 
> 
> What is the reason for this limitation?  Is there any chance that this
> limitation will be removed in the future?

The question is why do you need a profile for this? You can define 
defaults in .mvn/maven.config ...and during a CI build you can give 
other information via command line ?

I don't see the need for a profile ? Maybe you can elaborate a little 
bit more what the real problem is ? ...


Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message