Closed KuSh closed 1 year ago
Hi @KuSh!
I've installed Kotlin on my machine and everything looks fine
✦ ❯ sdk i kotlin
We periodically need to update the local cache. Please run:
$ sdk update
Downloading: kotlin 1.7.10
In progress...
######################################################################### 100,0%
Checksums are disabled, skipping verification...
Installing: kotlin 1.7.10
Done installing!
Setting kotlin 1.7.10 as default.
~ on ☁️ (eu-central-1)
✦ ❯ sdk current
We periodically need to update the local cache. Please run:
$ sdk update
Using:
java: 18.0.2-zulu
jbang: 0.97.0
jreleaser: 1.0.0
ki: 0.4.5
kotlin: 1.7.10
scala: 3.1.2
What is your output when you type
ls "$SDKMAN_DIR"/candidates/kotlin
on the commandline? It should look similar to mine
✦ ❯ ls $SDKMAN_DIR/candidates/kotlin
1.7.10 current
As a workaround, typing sdk default kotlin 1.7.10
should set Kotlin 1.7.10 as the new default.
Hi @helpermethod
❯ ls "$SDKMAN_DIR"/candidates/kotlin
1.7.10
It seems, contrary to you, it didn't automatically set kotlin as default neither did it asked me if it should do (that was the case for maven or java installs)
default
command doesn't seem to fix the problem, even if current link is created :
❯ sdk default kotlin 1.7.10
Default kotlin version set to 1.7.10
❯ ls "$SDKMAN_DIR"/candidates/kotlin
1.7.10 current
❯ sdk c
Using:
java: 17.0.4-tem
maven: 3.8.6
❯ sdk c kotlin
Not using any version of kotlin
Hi @KuSh,
is $SDKMAN_DIR"/candidates/kotlin/current
actually a symlink?
Could you also share your SDKMAN! config? You can easily access it by typing sdk config
.
Hi @helpermethod
"$SDKMAN_DIR"/candidates/kotlin/current
is a symlink
❯ ls -la "$SDKMAN_DIR"/candidates/kotlin/current
lrwxr-xr-x 1 nlecam staff 6 28 aoû 18:59 /Users/nlecam/.sdkman/candidates/kotlin/current -> 1.7.10
And here is my config:
sdkman_auto_answer=false
sdkman_auto_update=true
sdkman_insecure_ssl=false
sdkman_curl_connect_timeout=7
sdkman_curl_max_time=10
sdkman_beta_channel=false
sdkman_debug_mode=false
sdkman_colour_enable=true
sdkman_auto_env=false
sdkman_rosetta2_compatible=true
sdkman_auto_complete=true
sdkman_checksum_enable=true
sdkman_selfupdate_feature=true
Hi @KuSh,
how does the 1.7.0 directory look like? Could you do an
ls -la "$SDKMAN_DIR"/candidates/kotlin/1.7.10
Does the listing contain a bin/
directory?
how does the 1.7.0 directory look like? Could you do an
ls -la "$SDKMAN_DIR"/candidates/kotlin/1.7.10
Does the listing contain a
bin/
directory?
Hi, yes it is :
❯ ls -la "$SDKMAN_DIR"/candidates/kotlin/1.7.10
total 8
drwxr-xr-x 6 nlecam staff 192 1 fév 1980 .
drwxr-xr-x 4 nlecam staff 128 28 aoû 18:59 ..
drwxr-xr-x 14 nlecam staff 448 1 fév 1980 bin
-rw-r--r-- 1 nlecam staff 18 1 fév 1980 build.txt
drwxr-xr-x 57 nlecam staff 1824 1 fév 1980 lib
drwxr-xr-x 8 nlecam staff 256 1 fév 1980 license
Does the SDKMAN_CANDIDATES
array contain an entry for kotlin
?
echo ${#SDKMAN_CANDIDATES[*]}
# activemq ant asciidoctorj ballerina bpipe btrace concurnas connor cuba cxf doctooCClchain fli^C gaiden gradle gradleprofiler grails groovy groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter joern jreleaser karaf kcctl ki kobweb kotlin kscript layrry leiningen maven mcs micronaut mulefd mvnd mybatis neo4jmigrations pierrot pomchecker quarkus sbt scala scalacli schemacrawler spark springboot sshoogr taxi test tomcat toolkit vertx visualvm webtau znai
I suspect the kotlin
candidate is missing there.
Does the
SDKMAN_CANDIDATES
array contain an entry forkotlin
?I suspect the
kotlin
candidate is missing there.
It seems to be present :
❯ echo $SDKMAN_CANDIDATES
activemq ant asciidoctorj ballerina bpipe btrace concurnas connor cuba cxf doctoolchain flink gaiden gradle gradleprofiler grails groovy groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter joern jreleaser karaf kcctl ki kobweb kotlin kscript layrry leiningen maven mcs micronaut mulefd mvnd mybatis neo4jmigrations pierrot pomchecker quarkus sbt scala scalacli schemacrawler spark springboot sshoogr taxi test tomcat toolkit vertx visualvm webtau znai
❯ echo $SDKMAN_CANDIDATES | grep -c " kotlin "
1
I'm using zsh not bash as default shell BTW, doesn't know if that changes anything for sdkman (except for your array bashism to not work) Bash is available on the system :
❯ which bash
/bin/bash
❯ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.
Hi @KuSh,
I couldn't reproduce your bug on zsh either. It's probably best to analyze the debug output, which you can generate using
set -x; sdk current; set +x
This will output a lot of stuff but will also give us a clear picture of what is going on.
I couldn't reproduce your bug on zsh either. It's probably best to analyze the debug output
Hoping it can help: sdk.log
Hi @KuSh,
sorry for the late reply, caught a cold so couldn't look over your log sooner.
Now, for the interesting part: SDKMAN! finds the correct version, and even prints it on STDOUT, as you can see on the last 3 lines. So SDKMAN! is working as expected, but for some reason your shell seems to swallow the output. So I fear there is nothing we can do on our side.
+__sdk_current:16> __sdkman_determine_current_version kotlin
+__sdkman_determine_current_version:1> local candidate present
+__sdkman_determine_current_version:3> candidate=kotlin
+__sdkman_determine_current_version:4> present=+__sdkman_determine_current_version:4> __sdkman_path_contains /Users/nlecam/.sdkman/candidates/kotlin
+__sdkman_path_contains:1> local candidate exists
+__sdkman_path_contains:3> candidate=/Users/nlecam/.sdkman/candidates/kotlin
+__sdkman_path_contains:4> exists=+__sdkman_path_contains:4> grep /Users/nlecam/.sdkman/candidates/kotlin
+__sdkman_path_contains:4> exists=/Users/nlecam/.sdkman/candidates/maven/current/bin:/Users/nlecam/.sdkman/candidates/kotlin/current/bin:/Users/nlecam/.sdkman/candidates/jav a/current/bin:/Users/nlecam/.nvm/versions/node/v16.17.0/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/Caskroom/google-cloud-sd k/latest/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/usr/local/opt/python/libexec/bin
+__sdkman_path_contains:5> [[ -n /Users/nlecam/.sdkman/candidates/maven/current/bin:/Users/nlecam/.sdkman/candidates/kotlin/current/bin:/Users/nlecam/.sdkman/candidates/java /current/bin:/Users/nlecam/.nvm/versions/node/v16.17.0/bin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/Caskroom/google-cloud-sdk /latest/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin:/usr/local/opt/python/libexec/bin ]]
+__sdkman_path_contains:6> echo true
+__sdkman_determine_current_version:4> present=true
+__sdkman_determine_current_version:5> [[ true == true ]]
+__sdkman_determine_current_version:6> [[ $PATH -regex-match ${SDKMAN_CANDIDATES_DIR}/${candidate}/([^/]+)/bin ]]
+__sdkman_determine_current_version:7> [[ true == true ]]
+__sdkman_determine_current_version:8> CURRENT=current
+__sdkman_determine_current_version:14> [[ current == current ]]
+__sdkman_determine_current_version:15> CURRENT=+__sdkman_determine_current_version:15> readlink /Users/nlecam/.sdkman/candidates/kotlin/current
+__sdkman_determine_current_version:15> CURRENT=+__sdkman_determine_current_version:15> sed 's!/Users/nlecam/.sdkman/candidates/kotlin/!!g'
+__sdkman_determine_current_version:15> CURRENT=1.7.10
+__sdk_current:17> [ -n 1.7.10 ']'
+__sdk_current:18> [ 1 -eq 0 ']'
+__sdk_current:22> __sdkman_echo_no_colour 'kotlin: 1.7.10'
+__sdkman_echo_no_colour:1> echo 'kotlin: 1.7.10'
kotlin: 1.7.10
This is the code which outputs the line. Line numbers in the trace output are always relative to the function.
https://github.com/sdkman/sdkman-cli/blob/master/src/main/bash/sdkman-current.sh#L41
Thanks @helpermethod for all the help,
I found the problem at least. I did add a comment in my .zshrc about keeping sourcing sdkman-init.sh at the end of the file but didn't quite respect it. Moving it back at the end of my rc script fixes the problem !
Thanks again for the support
Great detective work @helpermethod!
Bug report
After installing kotlin through sdkman it isn't listed when calling
sdk current
andsdk current kotlin
tells us we don't use any version of kotlinTo reproduce
System info