sqldelight
sqldelight copied to clipboard
Connecting with the SQLDelight plugin failed: try building from the command line.
SQLDelight Version
2.0.0-alpha03
IDE Version
IntelliJ 2022.2
Dialect
PostgreSQL
Describe the Bug
Opening *.sq
files in the IDE always prints this header, source inspections don't seem to work.
Gradle plugin and IDE plugin are both 2.0.0-alpha03. Project is a pure-JVM Kotlin project.
Stacktrace
None
Description
IDEA log is full of lines at 100ms interval like
2022-08-07 12:16:47,353 [ 397641] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
2022-08-07 12:16:47,456 [ 397744] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
2022-08-07 12:16:47,562 [ 397850] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
2022-08-07 12:16:47,665 [ 397953] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
2022-08-07 12:16:47,772 [ 398060] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
2022-08-07 12:16:47,863 [ 398151] INFO - SQLDelight[warp-speed] - Fetching SQLDelight models
but not noticing any error lines
did some digging and debugging, this seems to be a JAVA_HOME
issue, SqlDelight plugin uses JAVA_HOME
to invoke Gradle. I'm using asdf
to manage my installations and some reason the asdf
shims from .zshrc
aren't picked up.
Did a workaround of adding an export JAVA_HOME=...
just before invoking the shims so that there's some env variable for the IDE to pick up.
My side is solved and I'm not sure whether the issue is with SqlDelight here, looks like a compat issue between asdf
and IDEA instead. OTOH would be nice to get a better error message ("JAVA_HOME
missing" or the like).
yea, we explicitly use java home for the gradle connector, though its surprising that it just continues to try even if its not working. I can try reproducing
and also agreed, it would be much better if the error just said java home was missing
@madisp Can you please describe where did you add export JAVA_HOME=...
and what value may it has? When I type java
in my Android Studio terminal, it looks OK - java is found but I'm getting the same error as you. No idea how to repair it...
@VitKap are you also using asdf
? I ended up adding the following to my .zshrc
:
. ~/.asdf/plugins/java/set-java-home.zsh
@madisp No, I'm not using asdf
- I've never heard of this tool before. Do you have an idea how to make SQLDelight plugin work?
I have the same problem with 2.0.0-alpha04, can't find how to solve it. Is it possible to use project SDK instead?
I had the same issue, with Android Studio Dolphin | 2021.3.1 Patch 1
on a macOS 13 M1 Mac
in case that helps, but thanks to:
yea, we explicitly use java home for the gradle connector, though its surprising that it just continues to try even if its not working. I can try reproducing
I built myself a version of the plugin with a hardcoded java home and it works now.
I seem to have found myself running into this issue. I have JAVA_HOME
set in my .zshrc
which later gets set by jenv
. I am launching Intellij via Jetbrains Toolbox. Unfortunately no luck with the sqldelight plugin.
IntelliJ IDEA 2022.3.1 (Community Edition)
Build #IC-223.8214.52, built on December 20, 2022
Runtime version: 17.0.5+1-b653.23 aarch64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 13.1
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 10
Metal Rendering is ON
Registry:
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Non-Bundled Plugins:
Docker (223.8214.52)
IdeaVIM (2.0.0)
DBN (3.3.5889.0)
org.jetbrains.kotlin-js-inspection-pack-plugin (0.0.12)
com.squareup.sqldelight (2.0.0-alpha05)
Kotlin: 223-1.7.21-release-272-IJ8214.52
Also had this issue when starting android studio from the toolbox app on macos. My solution was to set the java home env variable and launching android studio from the command line.
yea, we explicitly use java home for the gradle connector, though its surprising that it just continues to try even if its not working. I can try reproducing
@AlecStrong is there a reason to use JAVA_HOME here within the IntelliJ plugin rather than the SDK configured in IntelliJ's project settings? I bumped into this trying out an 2.0.0 alpha version, coming from 1.x. Setting JAVA_HOME on a development machine does solve this issue, but it seems like an unnecessary complication in our team's development environment setup when the rest of our tooling seems to fall in line under IntellliJ's project settings.
Running into this as well. SQLDelight is trying to use JAVA_HOME
which points to Java 11. Is it not expected to use the Gradle JDK path set in IDE settings?
Caused by: com.android.builder.errors.EvalIssueException: Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
Your current JDK is located in /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.