Archiva

Invalid version validation error when uploading a jar with a four-part version number

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.2.1
  • Fix Version/s: 1.2.1
  • Component/s: Web Interface
  • Labels:
    None
  • Environment:
    Archiva 1.2.1-SNAPSHOT trunk r761865
  • Number of attachments :
    2

Description

Archiva will not allow you to upload an artifact with a version number in the format 2.5-r123456-proj-1.2.3

We use this version number format to do internal releases of third-party artifacts.

Deploying from the command line works, but the artifact upload form in Archiva will not accept this version number and displays "Invalid version".

  1. MRM-1172.patch
    27/Apr/09 3:38 AM
    0.7 kB
    jan ancajas
  2. MRM-1172-2.patch
    06/May/09 3:06 AM
    3 kB
    jan ancajas

Issue Links

Activity

Hide
jan ancajas added a comment -

From what I've traced this has something to do with the version algorithm implementation :
1. tokenize the string using "-" (dash) as the separator
2. checks if each token matches the regex pattern (see below)
3. the token ratio between "matching tokens" and "all tokens" must be 75% or more.

From the example it's only 50%.

We can loosen the rule a bit to return true if the first token is a matching token. thoughts on this ?

        "([0-9][_.0-9a-z]*)",
        "(snapshot)",
        "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
        "(dev[_.0-9]*)",
        "(alpha[_.0-9]*)",
        "(beta[_.0-9]*)",
        "(rc[_.0-9]*)",
        "(debug[_.0-9]*)",
        "(unofficial[_.0-9]*)",
        "(current)",
        "(latest)",
        "(fcs)",
        "(release[_.0-9]*)",
        "(nightly)",
        "(final)",
        "(incubating)",
        "(incubator)",
        "([ab][_.0-9]+)"
Show
jan ancajas added a comment - From what I've traced this has something to do with the version algorithm implementation : 1. tokenize the string using "-" (dash) as the separator 2. checks if each token matches the regex pattern (see below) 3. the token ratio between "matching tokens" and "all tokens" must be 75% or more. From the example it's only 50%. We can loosen the rule a bit to return true if the first token is a matching token. thoughts on this ?
        "([0-9][_.0-9a-z]*)",
        "(snapshot)",
        "(g?[_.0-9ab]*(pre|rc|g|m)[_.0-9]*)",
        "(dev[_.0-9]*)",
        "(alpha[_.0-9]*)",
        "(beta[_.0-9]*)",
        "(rc[_.0-9]*)",
        "(debug[_.0-9]*)",
        "(unofficial[_.0-9]*)",
        "(current)",
        "(latest)",
        "(fcs)",
        "(release[_.0-9]*)",
        "(nightly)",
        "(final)",
        "(incubating)",
        "(incubator)",
        "([ab][_.0-9]+)"
Hide
jan ancajas added a comment -

attach patch for the proposed solution.

Show
jan ancajas added a comment - attach patch for the proposed solution.
Hide
Wendy Smoak added a comment -

Is there logic somewhere in Maven to decide whether a version number is valid? Why would Archiva be more strict about this?

I've never had a build fail due to an invalid version number... it may not be able to find the dependency, and creative version number formats don't work well with ranges, but not invalid.

Show
Wendy Smoak added a comment - Is there logic somewhere in Maven to decide whether a version number is valid? Why would Archiva be more strict about this? I've never had a build fail due to an invalid version number... it may not be able to find the dependency, and creative version number formats don't work well with ranges, but not invalid.
Hide
jan ancajas added a comment -

maven deploy plugin doesn't have this checking. it's only in archiva

Show
jan ancajas added a comment - maven deploy plugin doesn't have this checking. it's only in archiva
Hide
jan ancajas added a comment -

added UT. THanks

Show
jan ancajas added a comment - added UT. THanks
Hide
Maria Odea Ching added a comment -

Patch applied to trunk -r772151. Thanks Jan!

Leaving this issue for the documentation patch..

Show
Maria Odea Ching added a comment - Patch applied to trunk -r772151. Thanks Jan! Leaving this issue for the documentation patch..
Hide
Maria Odea Ching added a comment -

Updated documentation in trunk -r778123.

Show
Maria Odea Ching added a comment - Updated documentation in trunk -r778123.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: