-
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
Unexpected behavior of -DallowMajorReleases=false #454
Comments
Same issue here. I would not expect to see prerelease versions as well. |
Please use the newly added
(On POSIX-compatible shells, the option must be surrounded in single or double quotes so that it's not expanded by the shell) See also #684 |
I personally dislike the fact, that the property begins with @slawekjaranowski @cstamas WDYT? |
Use |
How about |
Sounds good |
I stumbled on this issue after looking for a fix specifically for update-properties (#552). While |
Sorry. This is indeed a bug. I must have overlooked this paragraph:
Yes, those qualified releases are indeed considered older than the .0 version, so the range which is being considered by the plugin is not at all correct. @sultan are you working on this by any chance? I saw that you were still busy with a PR for correcting range limits. Otherwise I'll gladly tackle this one. |
not working on anything rn, feel free to start, i'll jump on the boat later to help |
You tried that with |
am also trying more cases before final word |
Still not working on the master branch:
|
This ? : operator looks correct to me. Only if allowAny is false can we descend further and look for the unchanged segment. If it's true then we're returning empty(). By the way, the whole system of allow...updates is misconceived because those options are not independent. An enum would make much more sense. I was actually planning to overhaul it. Any allow...updates switch equals false implies that the more major switches are also false. And allowAllUpdates is more major than allowMajorUpdates. Anyway, I'll look into this issue tomorrow morning 😀 |
ternary operator looks correct to me too. in order to get correct result i was required to execute : -DallowAnyUpdates=false -DallowMajorUpdates=false about improvements:
others are a bit more complicated, i would like to introduce the possibility to disallow previews :
|
default previews pattern would be
overridable by -DpreviewsPattern default snapshot pattern would be
overridable by -DsnapshotsPattern |
Hmm the point the OP is making here is that the ranges for version discovery are incorrect. In particular, upper bound is constructed so that its (segment-1) segment is incremented, and the rest is left at zero. So, if we say that we want to see the possible upgrades filtered to minor versions for, say, 1.0.4, the range would be: [1.1.0, 2.0.0) The problem is that 2.0.0 is newer than 2.0.0-SNAPSHOT or 2.0.0-rc1, or 2.0.0-M1, or 2.0.0-ajarmoniuk. So 2.0.0-ajarmoniuk would be inside the range... Whilst we actually don't want anything with 2 in front! By the way, so the code responsible for computing the next range version (with the given segment incremented) is this: static ArtifactVersion copySnapshot( ArtifactVersion source, ArtifactVersion destination )
{
if ( isSnapshot( destination ) )
{
destination = stripSnapshot( destination );
}
final Matcher matcher = SNAPSHOT_PATTERN.matcher( source.toString() );
if ( matcher.find() )
{
return new DefaultArtifactVersion( destination.toString() + "-" + matcher.group( 0 ) );
}
else
{
return new DefaultArtifactVersion( destination.toString() + "-SNAPSHOT" );
}
} |
Hmm I saw that these are your changes. Actually, qualifiers are not restricted to private static final String[] QUALIFIERS = {
"snapshot", "alpha", "beta", "milestone", "preview", "rc", "", "sp" }; They can be anything after the hyphen. So, if we happen to have a version with the qualifier |
So, instead of incrementing the next segment to create a bound, which makes you want to exclude those "qualifiers", I'm actually thinking of introducing a notion of infinity on a given segment location. So, the filtered range for the lookup for a next minor version for 1.0.4 would be: [1.1.0, 1.∞.∞) ...-ish. |
well yes the system is hard on us. composer for php as a nice syntax with "1^". alas, would it be ok to read [1.1.0, 2) as [1.1.0, 2-snapshot) when the right bound is exclusive ? (non qualified ?) do we ask the user to limit "releases only" themself with -D ? looks like there is 2 problems to solve. |
Noo, it's not that hard. It's the version comparator which needs to be aware of it, and it's a part of this plugin. :) |
ok i'll try to work on a PR when i can |
Ah, actually I've been looking at it. 😄 |
Tbh, the function computing the update scope should probably look like this (but, like I said, the scope representation should probably be (internally at least) changed to an enum): private Optional<Segment> calculateUpdateScope()
{
if ( !allowIncrementalUpdates && !allowMinorUpdates && !allowMajorUpdates && !allowAnyUpdates )
{
throw new IllegalArgumentException( "One of: allowAnyUpdates, allowMajorUpdates, allowMinorUpdates, "
+ "allowIncrementalUpdates must be true" );
}
return allowAnyUpdates && allowMajorUpdates && allowMinorUpdates
? empty()
: allowMajorUpdates && allowMinorUpdates
? of( MAJOR )
: allowMinorUpdates
? of( MINOR )
: of( INCREMENTAL );
} and this infinity calculus + probably an additionally something less than zero for representing the snapshots. As it is now, the lowest bound gets restricted at version 0, which is, as we know, greater than all versions with the qualifier. |
Almost done.... |
This looks great. When can we expect 2.13.0 to be released? 😅 Edit: actually, I just tried it out from a local clone, and it doesn't seem to work for me? I tested with
and had e.g. - <spring-boot.version>2.7.4</spring-boot.version>
+ <spring-boot.version>3.0.0-M5</spring-boot.version> |
I see. The update (using the new BoundArtifactVersion) was not applied to all possible Mojos and all possible methods retrieving versions. The scope of the PR was limited to the issue at hand. So there's room for improvement. Working on it then. @slawekjaranowski to minimize the PR size, this won't be a big-bang PR fixing everything across the board, but multiple smallish PRs fixing particular mojos. |
@fgabolde if you use my branch, you'll get:
But, like I said, the same fix needs to be applied everywhere else... :( |
…o, UpdatePropertyMojo + adding it tests for resolve-ranges and update-parent
…o, UpdatePropertyMojo + adding it tests for resolve-ranges and update-parent
…o, UpdatePropertyMojo + adding it tests for resolve-ranges and update-parent
…o, UpdatePropertyMojo + adding it tests for resolve-ranges and update-parent
…ePropertyMojo + adding it tests for resolve-ranges and update-parent
Recently seen output of
display-dependency-updates
:A lot of these suggested updates are to prereleases (alpha, RC, M). A quick look at the docs suggests
-DallowMajorUpdates=false -DallowAnyUpdates=false
. Applying that:Well, that's not helpful.
spotbugs-annotations
is even worse now, instead of4.2.2
I get4.0.0-RC3
.It looks like
-DallowMajorUpdates=false
allows the latest release older than(X+1).0
, and based on Maven version math AFAIUI, that includes pre-release versions like(X+1).0-RC3
-- which is pretty unhelpful for my use case of trying to apply simple updates to actual releases.Either of the following would be an improvement:
-DallowMajorUpdates=false
, look only for releases within the same major version (i.e. "version number starts with X").-DallowMajorUpdates=false
I could get the latest available release of the current major line.The text was updated successfully, but these errors were encountered: