-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MNG-8211] Fail the build if CI Friendly revision used without value #1656
Conversation
As this is almost always source of confusion. If feature is used and there is no proper value set, fail the build, as users for sure does not plan to deploy artifacts with version `${revision}`. --- https://issues.apache.org/jira/browse/MNG-8211
Example failure: https://gist.github.com/cstamas/9dbb79be59ba22b6bc5c823d95593e50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems currently only one value is assumed but one can combine values e.g.
<version>${revision}${sha1}${changelist}</version>
see
maven/maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
Lines 1231 to 1245 in 76ff89f
Matcher m = CI_FRIENDLY_EXPRESSION.matcher(string.trim()); | |
while (m.find()) { | |
String property = m.group(1); | |
if (!versionProcessor.isValidProperty(property)) { | |
addViolation( | |
problems, | |
severity, | |
version, | |
fieldName, | |
null, | |
"contains an expression but should be a constant.", | |
tracker); | |
return false; | |
} | |
} |
...src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
Outdated
Show resolved
Hide resolved
This PR does it in wrong place:
|
Example of failure: https://gist.github.com/cstamas/01b1b6152aca56f1383148ef74245583 |
This PR would really help to reduce user confusion with CI Friendly version. |
Last example of failure but also the "escape hatch" in effect: https://gist.github.com/cstamas/1e880b2381bf1c543db052a1298e5074 |
As this is almost always source of confusion. If feature is used and there is no proper value set, fail the build, as users for sure does not plan to deploy artifacts with version
${revision}
(or any expression in project.version).Still, to not be disruptive, the old behaviour can be achieved by setting
maven.build.allowExpressionInEffectiveProjectVersion
=true project property.https://issues.apache.org/jira/browse/MNG-8211