[MAGNOLIA-6177] Version number cannot contain 2 hyphens Created: 28/Mar/15  Updated: 19/May/22  Resolved: 19/May/22

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Liang Shi Assignee: Magnolia International
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Not relevant


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

Hi,

we are finishing a magnolia based project recently, but there is a problem on the release process that magnolia doesn't allow version number with two hyphens and always considers everything after the first hyphen is the classifier.

here is a code snippet from info.magnolia.module.model.Version

final int classifierIdx = versionStr.indexOf('-');
        if (classifierIdx > 0) {
            classifier = versionStr.substring(classifierIdx + 1);
            if (!classifierValidation.matcher(classifier).matches()) {
                throw new IllegalArgumentException("Invalid classifier: \"" + classifier + "\" in version \"" + versionStr + "\"");
            }
            numbers = versionStr.substring(0, classifierIdx);
        }

I suggest change

final int classifierIdx = versionStr.indexOf('-');

to

final int classifierIdx = versionStr.lastIndexOf('-');


 Comments   
Comment by Magnolia International [ 22/Apr/15 ]

Hi,

Thanks for the report. I'm not sure this can be fixed without side-effects for others (who may have come to rely on this). Although AFAIK, we don't use the classifier for anything, so it should be OK. Is there no way for you to not have such a qualifier ? What build tool are you using ?

Comment by Liang Shi [ 22/Apr/15 ]

hi,

we are using maven und intend to have version number like ${project.version}${git.hash}${jenkins.buildNumber}-${classifier} e.g: 1.0.0-abcdefg-203-SNAPSHOT or 1.0.0-abfgdfs-204, classifier decides, which repo the built artifact will be uploaded.

the version number format is given, we solved this problem by changing the version format and use '.' as separator

Comment by Magnolia International [ 23/Apr/15 ]

Okay, good to know. I'll try to get this in in a next release, but hopefully using dots is satisfying for you until then?

Comment by Roman Kovařík [ 19/May/22 ]

Hello,

This ticket is now marked as closed due to one of the following reasons:

  • A long period of inactivity
  • Uses an old or Beta version of an application, module, or framework that we no longer support
  • The issue is no longer reproducible or has been fixed in later versions

If you are still facing a problem or consider this issue still relevant, please feel free to re-open the ticket and we will reach out to you.

Thank you,
The Magnolia Team

Generated at Mon Feb 12 04:12:02 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.