Could Anyone tell me how to build `kotlin`project ...
# kontributors
r
Could Anyone tell me how to build `kotlin`project ? I am talking about the kotlin language itself. On opening project in IntelliJ idea. I get options
Configure Modules with Java(Gradle)
,
Configure modules with JS(Gradle)
and two same options with
Maven
. From here on I am getting confused
d
Were you following the ReadMe guide (https://github.com/JetBrains/kotlin#-working-with-the-project-in-intellij-idea)? After using "New -> Module From Existing Sources" you shouldn't see any "Configure Kotlin" popups (you'll see some " Configure Maven projects", just ignore them)
r
Yes I followed them . I saw these options. Should Ignore them ?
d
You can, but something may not work properly. You shouldn't see Configure Kotlin pop-ups after successful import. First of all, try to run
./gradlew dist
from command line to see if project builds fine. Then, try to re-import everything from a scratch (
git clean -xdf
may help, though it will remove all unstaged or untracked changes). Make sure to not press anything (including any configuration/import suggestion pop-ups) after opening a project until you make "New Module From Existing Sources". If that won't help, try running
Refresh Gradle Projects
from the Gradle ToolWindow and see if projects works fine for you (code is resolved, completion works, etc.)
r
I am getting this error while
./gradlew dist
in Kotlin project . Could anyone help me with this
Copy code
> Task :core:util.runtime:compileJava FAILED
/home/thelimitbreaker/IdeaProjects/kotlin/core/util.runtime/src/org/jetbrains/kotlin/utils/WrappedValues.java:72: type parameters of <V>V cannot be determined; no unique maximal instance exists for type variable V with upper bounds V,java.lang.Object
        return unescapeNull(unescapeThrowable(value));
                           ^
/home/thelimitbreaker/IdeaProjects/kotlin/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java:322: type parameters of <V>V cannot be determined; no unique maximal instance exists for type variable V with upper bounds T,java.lang.Object
            if (!(_value instanceof NotValue)) return WrappedValues.unescapeThrowable(_value);
                                                                                     ^
/home/thelimitbreaker/IdeaProjects/kotlin/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java:327: type parameters of <V>V cannot be determined; no unique maximal instance exists for type variable V with upper bounds T,java.lang.Object
                if (!(_value instanceof NotValue)) return WrappedValues.unescapeThrowable(_value);
                                                                                         ^
/home/thelimitbreaker/IdeaProjects/kotlin/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java:427: type parameters of <V>V cannot be determined; no unique maximal instance exists for type variable V with upper bounds V,java.lang.Object
            if (value != null && value != NotValue.COMPUTING) return WrappedValues.unescapeExceptionOrNull(value);
                                                                                                          ^
/home/thelimitbreaker/IdeaProjects/kotlin/core/util.runtime/src/org/jetbrains/kotlin/storage/LockBasedStorageManager.java:435: type parameters of <V>V cannot be determined; no unique maximal instance exists for type variable V with upper bounds V,java.lang.Object
                if (value != null) return WrappedValues.unescapeExceptionOrNull(value);
                                                                               ^
5 errors

FAILURE: Build failed with an exception.
@dsavvinov could you please give me some more guidance
d
Honestly, it's the first time I've ever heard of such a error. Check your Java versions; if you set your JDK_16 path point to JDK 1.8, try pointing it to 1.6 instead.
r
I have pointing to JDK_16 = JDK 1.6. similarly for JDK 1.7 and JDK 9 . And default is JDK 1.8
d
That's weird. Well, as the workaround you can locally cast value of
unescapeExceptionOrNull
to
T
explicitly (as proposed here: https://stackoverflow.com/questions/5666027/why-does-the-compiler-state-no-unique-maximal-instance-exists) If you'll find the root issue, feel free to reach me, I'm genuinely curious)
r
Sure. I will dig into this
Hello updated my project from upstream. And Now when I try to build project, I am getting this.
Copy code
Please set environment variables: JDK_16, JDK_17, JDK_9 to point to corresponding JDK installation.
I have set these environment variables in my machine in ~/.bashrc like this on my linux machine
Copy code
# Java
export JAVA_HOME="/usr/java/jdk1.8.0_202"
export JDK_16="/usr/java/jdk1.6.0_07"
export JDK_17="/usr/java/jdk1.7.0_80"
export JDK_18="/usr/java/jdk1.8.0_202"
export JDK_9="/usr/java/jdk-9.0.4"
Also setup these environment variables in Intellij IDEA's environment variables of terminal
Still getting
Copy code
Please set environment variables: JDK_16, JDK_17, JDK_9 to point to corresponding JDK
Ok this issue is resolved. After adding environment variables in INtellij Idea . I added quotes in the path to JDKs . I just removed them. So this issue was resolved
But now I am facing this . AFAIU, Either some problem with my JDK_9 or it is using default java 8 compiler to compile java 9 resources which is throwing exception
Update Issue is solved - Previously I checked
auto imports
during import of projects - I directly imported project instead of opening project -> import module from existing source. Couldn't figure out what made the above error though 😶 Thank you for earlier suggestion of type casting . It built project