versions: Invalid segment error when version contains more than 3 segments

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

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 21 (10 by maintainers)

Commits related to this issue

Most upvoted comments

There are 59 more issues to go. I hope that not every single one has to be solved to unblock

Guys, I’ll look into it.

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.

mvn versions:use-latest-versions -DallowMajorUpdates=false -DallowMinorUpdates=false 

Hi… i use 2.5 of maven-versions-plugin and have Google Analytics as dependency ( https://mvnrepository.com/artifact/com.google.apis/google-api-services-analytics ).

I get the message: [ERROR] Failed to execute goal org.codehaus.mojo:versions-maven-plugin:2.5:update-properties (default-cli) on project aldi-bus-bom: Execution default-cli of goal org.codehaus.mojo:versions-maven-plugin:2.5:update-properties failed: Invalid segment, 1, for the 1 segment version: ‘v3-rev126-1.19.1’

Is this relevant? Is there a work around?

Thanks.

What i’ve done locally and temporarily is gone into the 3 VersionComparator classes, commented out the throw to InvalidSegment exception and instead

            System.out.println(String.format( "Can't Touch this: Invalid segment, %d, for the %d segment version: '%s'", segment, segmentCount,
                    v.toString() ) );
            return (v);

Based on first impressions, i’m liking this behavior more.