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

asdf-java incompatibilities #2

Closed
blopker opened this issue Jan 27, 2023 · 10 comments
Closed

asdf-java incompatibilities #2

blopker opened this issue Jan 27, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@blopker
Copy link

blopker commented Jan 27, 2023

There seems to be 2 (non-critical?) errors thrown with the Java plugin when installing a new Java version:

❯ rtx install java@openjdk-19.0.2
rtx: Installing runtime: java@openjdk-19.0.2
/Users/blopker/.local/share/rtx/plugins/java/bin/install: line 3: /Users/blopker/.asdf/lib/utils.bash: No such file or directory
######################################################################################################## 100.0%
openjdk-19.0.2_macos-aarch64_bin.tar.gz
openjdk-19.0.2_macos-aarch64_bin.tar.gz: OK
/Users/blopker/.local/share/rtx/plugins/java/bin/install: line 139: get_asdf_config_value: command not found

It seems to install fine though, not sure if it's worth investigating.

Also, rtx install java does not work. Not sure if it should though.

@jdx
Copy link
Owner

jdx commented Jan 27, 2023

I can dig into this more tomorrow. It's likely just that I'm missing some environment variable that asdf sets.

Also, rtx install java does not work

This is actually an issue with the plugin (arguably). It doesn't output any "normal" versions that start with a number. It's an issue in asdf as well:

❯ asdf latest java
No compatible versions available (java [0-9])

I'm not sure what should happen here but it likely needs to be fixed in the java plugin. One thought I had is maybe it should use the bin/latest-stable script. Currently rtx doesn't use that since I couldn't find a plugin that used it as a reference. Java doesn't have it either so we'd need to first put one in the plugin for that to be a solution.

@jdx
Copy link
Owner

jdx commented Jan 27, 2023

oh, reading the code, it actually is importing some asdf source code. That obviously isn't there since asdf isn't installed. If you installed asdf (just didn't add it to your shell rc) that should fix it. It has to be in that directory though, so run:

git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.1

We may need a longer term solution here though, especially if this is something happening in other plugins.

@blopker
Copy link
Author

blopker commented Jan 27, 2023

Cool, yeah, not a blocker at all, just thought I'd surface it in case another plugin does break. I think the Java plugin (and to an extent Java) is just weird. I'd say it should default to openjdk, but I'm sure people would argue otherwise.

I'm never installing asdf again! 😛

@jdx
Copy link
Owner

jdx commented Jan 27, 2023

I explain this in the readme but the java plugin is actually probably the best suited to rtx over asdf (barring this hiccup). You don't need to setup the special asdf-java shell extension to get JAVA_HOME to work, it'll just set JAVA_HOME automatically the way you expect.

@jdx
Copy link
Owner

jdx commented Jan 27, 2023

though, that's a theory, I'm not a java dev so maybe you can tell me how well it actually works :)

@blopker
Copy link
Author

blopker commented Jan 27, 2023

As far as I know, JAVA_HOME is not for the executable, but largely used by other tooling to find the Java SDK. For example, IDEs will use it to find the right source files to import. Although since IDEs usually configure that themselves I've never had an issue with asdf not setting it properly.

@jdx
Copy link
Owner

jdx commented Jan 31, 2023

I did test java somewhat and it seems to work reasonably well. It does throw this error but it isn't important. There is also the matter of there not being a default version.

I think barring some rough solutions these both rely on changes within the plugin, or perhaps forking the java plugin into an RTX variant so that's the one that gets picked up when you run rtx install java

That said, there are a ton of other issues people have raised that I feel are more important so this one has dropped near the bottom of my queue. I'd be happy to consider any solutions here, or if the problems are bigger than I see let me know.

I'll keep this open of course, I just figured I'd let you know I don't think it's super likely I'll get around to this in the near term.

@blopker
Copy link
Author

blopker commented Jan 31, 2023

Thanks for the follow up! I'm not blocked or really effected by this. Thanks for making sure it's not a big issue.

I'm good with this outcome, I have know problem if you want to close it.

@jdx jdx changed the title The Java plugin seems to throw errors asdf-java incompatibilities Jan 31, 2023
@jdx jdx pinned this issue Feb 1, 2023
@roele
Copy link
Contributor

roele commented Feb 8, 2023

I'm not sure what should happen here but it likely needs to be fixed in the java plugin. One thought I had is maybe it should use the bin/latest-stable script. Currently rtx doesn't use that since I couldn't find a plugin that used it as a reference. Java doesn't have it either so we'd need to first put one in the plugin for that to be a solution.

The problem with asdf is that it only has a notion of version for a particular plugin. Several plugins are meanwhile provided in various distributions/variants (e.g. Java: Azul, OpenJDK, ... or Python: Anaconda, PyPy, ...) So it rather should support something like plugin@distribution:version. This leads to countless issues with commands like latests etc.

@jdx jdx unpinned this issue Feb 11, 2023
@jdx
Copy link
Owner

jdx commented Feb 26, 2023

I'm going to close as it seems this is resolved. The problem we talked about is really in asdf-java if it's anywhere.

@jdx jdx closed this as completed Feb 26, 2023
jdx added a commit that referenced this issue Apr 9, 2024
134130 added a commit to 134130/mise that referenced this issue Jul 20, 2024
…kotlin.jvm-2.0.0

Bump org.jetbrains.kotlin.jvm from 1.9.24 to 2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants