Skip to content
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

Solidarity cannot parse Java 11.0.16 correctly #269

Open
tnguyen42 opened this issue Jan 30, 2023 · 1 comment
Open

Solidarity cannot parse Java 11.0.16 correctly #269

tnguyen42 opened this issue Jan 30, 2023 · 1 comment

Comments

@tnguyen42
Copy link

For some reason, using this configuration of java:

{
        "rule": "cli",
        "binary": "java",
        "version": "--version",
        "semver": ">=11 <12"
      }

seems to work correctly for most Java version, but Solidarity doesn't identify Java 11.0.16 as a valid version.
My guess is that the version isn't parsed correctly. Is this an easy fix?

Additional information:
The output of java --version using this version is:

openjdk 11.0.16.1 2022-07-19 LTS
OpenJDK Runtime Environment Zulu11.58+23-CA (build 11.0.16.1+1-LTS)
OpenJDK 64-Bit Server VM Zulu11.58+23-CA (build 11.0.16.1+1-LTS, mixed mode)

While the output of java --version using 11.0.17 (which works) is:

openjdk 11.0.17 2022-10-18 LTS
OpenJDK Runtime Environment Zulu11.60+19-CA (build 11.0.17+8-LTS)
OpenJDK 64-Bit Server VM Zulu11.60+19-CA (build 11.0.17+8-LTS, mixed mode)
@iegik
Copy link

iegik commented Jun 1, 2023

@tnguyen42 Hi! When I reinvented Solidarity in Bash yesterday, I have noticed, that semver binary do not correctly understand version number containing only major or major and minor version numbers. You need to provide full SemVer pattern (x.x.x) like >=11.0.0 <12.0.0.

{
        "rule": "cli",
        "binary": "java",
        "semver": ">=11.0.0 <12.0.0",
        "error": "You have java@{{installedVersion}}. Fix with `sdk install java {{wantedVersion}} && sdk use java {{wantedVersion}}`. More info https://sdkman.io/install"
      }

semver "14.3" -r ">=13.0.0" vs semver "14.3" -c -r ">=13.0.0" will have different result

-c --coerce
Coerce a string into SemVer if possible
(does not imply --loose)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants