-
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
Invalid segment error when version contains more than 3 segments #251
Comments
Which version of versions-maven-plugin do you use? |
I've reproduced it with the head of master, so 2.6-SNAPSHOT. Which i'm just starting to use now. I am currently on 2.1 but as part of my move to 2.6 i'm also trying to rework my usage of it. |
What i've done locally and temporarily is gone into the 3 VersionComparator classes, commented out the throw to InvalidSegment exception and instead
Based on first impressions, i'm liking this behavior more. |
Hi... I get the message: Is this relevant? Is there a work around? Thanks. |
Open from Jan. Still nothing... Is this error expected? Are we doing something wrong? In my case invalid segment error occurs only if I am ignoring minor & major updates.
|
I encounter the same issue. Should use-latest-versions skip segments anyway? Or at least propose an option not to process segments? |
@blacelle Would you mind filing a PR from your fork? |
Also applies to |
this is super annoying. fails on multiple like:
|
This basically undoes any benefit of updating through the plugin |
I'm getting the same error when I run but NOT if I run: although in the latter case it still implements minor version updates. |
Same here for property <goals>
<goal>display-property-updates</goal>
<goal>display-dependency-updates</goal>
</goals>
<configuration>
<allowAnyUpdates>false</allowAnyUpdates>
<allowMajorUpdates>false</allowMajorUpdates>
<allowMinorUpdates>false</allowMinorUpdates>
</configuration> Plugin version: 2.8.1. |
Not sure if this helps but according to the version rules documentation on the homepage (see https://www.mojohaus.org/versions-maven-plugin/version-rules.html)
So (if I read this correctly), a version like |
There's a notice at the top that basically calls into question the whole page. |
Guys, I'll look into it. |
Related, has to do with the way segments are determined. |
I appreciate the maven versioning policy however it might fit the reality (but in such irregular cases Maven and the plugin will simply treat the whole version as qualifier), but the issue people are dealing with here is that those irregular dependencies act as poison for the plugin: the whole run will be stopped by a single such dependency. This is why some chose to patch the plugin and "sanitise" the exception. So, I'm working on a fix. |
This comment was marked as off-topic.
This comment was marked as off-topic.
The more I look into it, the more issues I see:
if ( segment > segmentCount )
{
throw new InvalidSegmentException( segment, segmentCount,
version.toString() );
}
There are probably more problems with this, but I'll limit the scope of this item to the issue OP raised only. The other findings will be done as separate issues. |
The PR will be rather large due to the fact that I'm leveraging the |
…nvalidVersionSpecificationException
The reason for that is that the check would only fail if the determined "leftmost unchanged segment" is greater than the determined number of segments in the version. "leftmost unchanged segment" is based on your "allow{Major,Minor,Incremental}Updates" flags (those flags are actually a sort of enum switch), and will assume -1 for Major (meaning no restrictions), 0 for minor (meaning only major segment is restricted), and so forth. So, the exception would only be raised if that segment is greater (actually should have been greater or equal because it's 0-based, but that's for another PR) than the total number of segments ;) However, this will be effectively fixed once the PR gets merged in. |
…rsionSpecificationException
According to this blog,
http://blog.soebes.de/blog/2017/02/04/apache-maven-how-version-comparison-works/
Maven now supports more than 3 segments. However the versions plug-in immediately dies with
[ERROR] Failed to execute goal use-latest-versions (default-cli) on project mdm: Execution default-cli of goal use-latest-versions failed: Invalid segment, 1, for the 1 segment version: '2.2.38.141' -> [Help 1]
Any time it comes across a version with more than 3 segments. I've been mitigating this in the past with a long long list of -Dexcludes , however that's a manual effort.
I'm wondering if @khmarbaise you have anything planned to address this. Would it be appropriate to instead of fail and throw an error, WARN that a version has not been updated, or that it has been skipped?
Thx
The text was updated successfully, but these errors were encountered: