-
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
[3.8.x][MNG-7407] Introduce a ModelVersionProcessor component to make CI Friends Versions pluggable #674
Conversation
} | ||
if ( request.getSystemProperties().containsKey( SHA1_PROPERTY ) ) | ||
{ | ||
modelProperties.put( SHA1_PROPERTY, request.getSystemProperties().get( SHA1_PROPERTY ) ); |
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.
@rfscholte I believe that this is a bug in our code since those are are supposed to be user properties and not system properties or we need to support both. @laeubi Not a regression from you, but an observation.
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.
As far as I understand the idea ias that system properties given on the command line take precedence over everything else.
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.
True, but those are not system properties, those are user properties. A common misconception and badly coined in the Maven core codebase. See:
maven/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Lines 1743 to 1753 in 4476026
private static void setCliProperty( String name, String value, Properties properties ) | |
{ | |
properties.setProperty( name, value ); | |
// ---------------------------------------------------------------------- | |
// I'm leaving the setting of system properties here as not to break | |
// the SystemPropertyProfileActivator. This won't harm embedding. jvz. | |
// ---------------------------------------------------------------------- | |
System.setProperty( name, value ); | |
} |
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.
Okay I have changed the PR accordingly.
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.
@rfscholte I believe that this is a bug in our code since those are are supposed to be user properties and not system properties or we need to support both.
It should be at least user properties. That's probably enough, as I expect that's the way CI servers can provide a value.
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.
Looks sane to me, needs testing though. Open questions:
- Why for Maven 3.8.x only? No master?
- The title is misleading. What you actually did is to move a default implementation to a replace component. @cstamas Did this also in resolver. May be can better rewording this to something like: Introduce a ModelVersionProcessor component to make CI Friends Versions pluggable
- Can this be covered by a test somehow?
I can open a PR for master also.
Sure do you simply want to rename the PR or should I do so?
There are already some tests for this functionality that also run fine with this changes. |
Yes, please.
Yes, please. PR and JIRA issue.
Please point me to them. |
I think this is where it is tested Lines 804 to 860 in 6ca13af
|
0ec6ebf
to
ac42c96
Compare
Title updated as you suggested. |
Indeed, this should be enough for the default implementation. |
Done: #675 |
Please rebase |
Versions pluggable
ac42c96
to
5f9cfa1
Compare
Done. |
…endly Versions pluggable This closes #674
…endly Versions pluggable This closes #674
Merged. |
Currently the handling for https://maven.apache.org/maven-ci-friendly.html is hard wired into maven.
For Tycho we like to replace/extend the default handling for this to supply the user with some automatic derived values for some of the variables.
This PR extracts the parts of that handling in a new
ModelVersionProcessor
that has the current behavior as a default implemented. This not only makes it more clear how this is handled (no cross references betweenDefaultModelValidator
andAbstractStringBasedModelInterpolator
required) but also allows to override the handling by a core extension.FYI @mickaelistria @akurtakov
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] SUMMARY
, where you replaceMNG-XXX
and
SUMMARY
with the appropriate JIRA issue. Best practice is to use the JIRA issuetitle in the pull request title and in the first line of the commit message.
mvn clean verify
to make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.