jbangdev / jbang

Unleash the power of Java - JBang Lets Students, Educators and Professional Developers create, edit and run self-contained source-only Java programs with unprecedented ease.
https://jbang.dev
MIT License
1.4k stars 156 forks source link

Catalog script-ref could contain version range #1734

Closed cstamas closed 6 days ago

cstamas commented 8 months ago

Is your feature request related to a problem? Please describe. MIMA "stable" is 2.x, while 3.x has alpha-2 latest released into Maven Central.

JBang catalog has entry "script-ref": "eu.maveniverse.maven.mima:cli:RELEASE" that currently picks up 3.0.0-alpha-2.

I'd like to split these into mima (2.x) and mima3 (3.x) in catalog but unsure how.

Describe the solution you'd like Would be great if script ref would accept version range?

Describe alternatives you've considered Manually maintain catalog, maybe...

Additional context None.

cstamas commented 8 months ago

Currently catalog looks like this: https://github.com/maveniverse/jbang-catalog/blob/aad55a1351bedccc3eaa7b7381ad8b14095d08e8/jbang-catalog.json

This implies I'd need to manually keep it up to date...

cstamas commented 8 months ago

Since then catalog updated with latest releases: https://github.com/maveniverse/jbang-catalog/blob/1003d7572b4c7a862cde319b13e307b77c6ae907/jbang-catalog.json

And I think this is "okay". This issue is really just "good to have".

maxandersen commented 8 months ago

You should actually be able to use maven range syntax here.

I think your approach of using mima2 and mima3 and mima is pragmatic.

You can also use refer to branches in the catalog name but then you probably better of using the mima repo directly...

maxandersen commented 6 days ago

so i just checked and jbang eu.maveniverse.maven.mima:cli:(2.0,3.0) is accepted as syntax but to my surprise this picks up 3.0.0-alpha-3 ...is mima not doing version resolution right by any chance or we have a bug somewhere?

quintesse commented 6 days ago

No it's how Maven works it seems:

"Following the Semantic Versioning Spec and basic common sense, 4.0.0-alpha-1 is a pre-release version of 4.0.0. So it is a lesser version:3.0.0 < 3.141.59 < 4.0.0-alpha-1 < 4.0.0. So Maven resolved the dependency following our specification: anything greater then 3.141.59 and lesser then 4.0.0. This is legit basic math!"

(from https://michakutz.medium.com/legit-but-useless-maven-version-ranges-explained-d4ba66ac654)

maxandersen commented 6 days ago

ah you found someone document the weirdness i feared.

well then thats settled maven is weird and yes you can use maven version ranges ..just need to be something like jbang eu.maveniverse.maven.mima:cli:(2.0,2.99999)

closing as "works as maven likes it".