-
Notifications
You must be signed in to change notification settings - Fork 267
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
Alter session for version discovery #965
Alter session for version discovery #965
Conversation
Maven behaviour (w/o any user settings, so OOTB) is to apply "never" policies to metadata, hence versions plugin will make Maven download ONCE the metadata, and NEVER again. Unless users use `-U` that in turn is TOO MUCH, as whole maven session is being updated in that case (it is global option). Instead, make versions pluging derive session from global, and set update policy ALWAYS but pinpointing that ONLY to the given artifact being discovered.
@slawekjaranowski @slachiewicz @ajarmoniuk ping |
I wish I were a maintainer, but for the time being I can't approve the workflow 😉 EDIT I can actually. |
@@ -273,11 +274,15 @@ public ArtifactVersions lookupArtifactVersions( | |||
repositories = emptyList(); | |||
} | |||
|
|||
// in future sessions may become AutoCloseable, so all this would go into try-with-resource block |
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.
This should be marked with TODO then
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.
unsure, i just left it here. IMHO is not TODO as session is NOT YET AutoCloseable, may be 1.11.x or maybe 2.0 but nobody can tell WHEN it will be. OTOH, "TODO" would mean "do it if you can", but it cannot be done today.
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.
NOTE?
Am not a maintainer either here, so I will just leave this here for @slawekjaranowski or anyone else to handle. Comment may be removed, I just added it like "head up", but it may happen in near or far future (I cannot tell). |
I'm not sure if it is good way, after it every execute plugin will cause download every metadata again. For projects with many dependencies it can be an issue. |
@slawekjaranowski every metadata? only targeted, only Point with |
@slawekjaranowski or if I misunderstood you, and you mean "will refresh metadata for maven-clean-plugin in EVERY module of the possibly 100 module build? so perform 100 refreshes?" That is not the case, as resolver refreshes once per session, so yes, it will refresh once in first module clean plugin is found, and from then on (in remaining 99 modules) cached results are used. |
As I see issue from #959 is that we don't have or is wrong property for last modified in properties file. Because default central plugin repository has policy never - https://github.com/apache/maven/blob/6f136ef4d2b4938e939189e9d2e3e0faa11a20e9/maven-model-builder/src/main/resources/org/apache/maven/model/pom-4.0.0.xml#L53 Last I did improvement for repository with never policy to use daily #957 - maybe it will be good enough is such case. |
I try to remove properties from version 2.15.0 - doesn't refresh metadata |
Cool then, was unaware that this plugin overrides configured policy. But am fine, so if it works as you tested, am fine with it. |
Alter session used for discovery, pinpoint ONLY to processed artifact to update ALWAYS. This would fix all the problems reported here #959 and here https://issues.apache.org/jira/browse/MRESOLVER-363 just like
-U
does (and people do it by reflex). But this is more correct way, as-U
is global and refreshes too much.