"package org.jetbrains.kotlin.gradle does not exist," etc. building intellij-community at master following README
I have found a way to work around these problems, but I suspect they aren't supposed to happen in the first place, so I'm posting here in case you want to take any action -- or, at worst, so that anyone who encounters similar problems can use my workaround.
The problem:
I'm trying to build intellij-community from master (5b4fa2a13a3ec2befcee810433428b2d578ace86; android 70133cbe5ef65acd8cdf5c38fea9d586f8cc1bfd; android/tools-base 17e9c8b666cac0b974b1efc5e1e4c33404f72904). I've followed the README as far as running "Build | Build Project." At that point, I see a handful of errors. For example:
GradleInitScripts
import org.jetbrains.kotlin.gradle.AbstractKotlinGradleModelBuilder;
Error:(47, 35) java: package org.jetbrains.kotlin.gradle does not exist
AndroidGradleProjectResolver
import org.jetbrains.kotlin.kapt.idea.KaptGradleModel;
Error:(66, 38) java: package org.jetbrains.kotlin.kapt.idea does not exist
As best I can tell, I need to do both of the following to eliminate the errors:
- Set up dependencies with `cd build/dependencies && ./gradlew :setupDependencies` (per this announcement). (If I skip this step, I notice the message "Library 'KotlinPlugin' has broken paths.")
- Add the "KotlinPlugin" library as a dependency of the following 4 modules: intellij.android.core, intellij.android.core.tests, intellij.android.kotlin.idea, intellij.android.kotlin.extensions.
I assume that there's a real fix than this that would make the manual edits necessary, but I'm not familiar enough with the build setup to know what it would be. And I'm not sure if the Gradle step is supposed to happen automatically? (I think I have the Gradle plugin enabled -- certainly I can run it from within IntelliJ -- but maybe setupDependencies is supposed to run automatically? If not, maybe the README should mention it?)
Please sign in to leave a comment.
One other related problem I caused for myself: I initially tried to build with an OpenJDK. This led to an additional set of "package does not exist" errors, such as:
The fix for that was clear enough: Use an Oracle JDK. I guess that the README at least implies this when it refers to "u91," which I think is an Oracle-JDK-specific term. But it might be worthwhile to stick the word "Oracle" in the README, given how easy it would be. I'm happy to send a PR if that helps.
You don't need to run Gradle tasks to compile intellij-community project, Build Project should do all the work. The mentioned compilation errors seem to be caused by problems with downloading a library from Maven repositories, see IDEA-230792 for details and a possible workaround.
KotlinPlugin library is optional, it's used as a runtime dependency in some tests only, so currently it's ok to have invalid paths in that library. I hope we'll get rid of this library in future.
Thanks! "Build Project" doesn't seem to have done all the work in my case. (Some evidence: If I recall correctly, I didn't have a `build/dependencies/build` until I ran `./gradlew :setupDependencies`.) I wish I had some idea for you about what I might have done differently than normal.
Thanks for the link to IDEA-230792. Sure enough, with a new project, I see the problem described there[*]. What I was seeing last week was different, though -- no Maven Dependency Resolver error, but instead a bunch of progress with a handful of errors.
Setting all that aside, though, the biggest news for me is that, even though Build Project fails for me (because of my original issue in my old project and because of IDEA-230792 in my new project), I can still use plain Run to build and run just the IDE itself :) Thanks again. (You might call attention to this in the README if you think it's likely to be a common problem, but if I'm the only one with this specific problem and if the other problem will be fixed soon, there's probably no need.)
[*] Specifically:
Failed to collect dependencies at org.jetbrains.kotlin:kotlin-plugin-ij193:jar:1.3.70-eap-42 -> org.jetbrains.kotlin:idea-gradle-tooling-api:jar:1.3.70-eap-42:
Failed to read artifact descriptor for org.jetbrains.kotlin:idea-gradle-tooling-api:jar:1.3.70-eap-42:
Could not transfer artifact org.jetbrains.kotlin:idea-gradle-tooling-api:pom:1.3.70-eap-42 from/to maven4 (https://repo.labs.intellij.net/jet-sign): repo.labs.intellij.net: Name or service not known:
Unknown host: repo.labs.intellij.net: Name or service not known
I didn't try the workaround, since I have all that I need now that I know that Run works even though "Build Project" does not.
One other related problem I caused for myself: I initially tried to build with an OpenJDK. This led to an additional set of "package does not exist" errors, such as:
The fix for that was clear enough: Use an Oracle JDK.
Faced the same. But used Zulu JDK (https://www.azul.com/downloads/zulu-community/ ) instead of Oracle - just because this is the latest 1.8 JDK with JavaFX that I've downloaded.
Anyway this issue should be clearer in README.