Skip to content
This repository has been archived by the owner on Aug 19, 2020. It is now read-only.

IDEA editing support is broken in 5.1 if gradle project root is not the same as IDEA project root #1308

Closed
pacher opened this issue Jan 7, 2019 · 4 comments
Assignees
Milestone

Comments

@pacher
Copy link

pacher commented Jan 7, 2019

Steps to Reproduce (for bugs)

  1. Create empty project in IDEA
  2. File -> New -> Module from Existing Sources... and pick "hello-kotlin" sample project from somewhere on the file system
  3. Open build.gradle.kts file in IDEA

Current Behavior

Error "can not access script base class org.gradle.kotlin.dsl.KotlinBuildScript"
IDEA can not resolve build script dependencies, everything red, so IDE editing of build scripts is unusable.

Building and running works, ".gradle" cache folder is created in module root (hello-kotlin folder)
When build.gradle.kts file is opened in IDEA - the second ".gradle" cache folder is created in IDEA project root.

Context

It was working fine with gradle 5.0, the problem is in 5.1

The only possible project layout now is when root build script is directly in IDEA project root. Then those two ".gradle" cache folders collapse into one and everything works as expected. But even in layout like IDEA Project root \ Some other module root folder \ build.gradle.kts I get two cache folders and broken script resolution.

But it would be very nice to have several gradle projects (composite build) as different modules within one IDEA project

Your Environment

Everything fresh with latest updates possible
Windows 10, jdk 11.0.1, gradle 5.1, IDEA 2018.3.2, kotlin 1.3.11

@bamboo bamboo self-assigned this Jan 18, 2019
@bamboo bamboo added this to the 1.2.0 milestone Jan 18, 2019
@eskatos eskatos modified the milestones: 1.2.0, 1.1.2 Jan 22, 2019
bamboo added a commit that referenced this issue Jan 22, 2019
In order to avoid serialization issues observed on Java 11.

Resolves #1308
@bamboo
Copy link
Member

bamboo commented Jan 22, 2019

Hi @pacher, thanks for the report.

Could you check if the following Gradle distribution fixes the issue for you?

    ./gradlew wrapper --gradle-distribution-url https://repo.gradle.org/gradle/kotlin-dsl-snapshots-local/gradle-kotlin-dsl-5.2-20190122225509+0000-all.zip

@pacher
Copy link
Author

pacher commented Jan 23, 2019

Hello @bamboo

I followed the steps to reproduce and the issue seems to be fixed. Yay! Thanks a lot.
Script dependencies are resolved, syntax highlighting and code completion works.

There are still two .gradle cache folders though, is it normal and expected? Does not feel right.
The second .gradle is created in IDEA project root folder when a *.gradle.kts file is opened in IDEA.

Thanks again for the fix and have a nice day ;-)

@eskatos
Copy link
Member

eskatos commented Jan 23, 2019

Good, thanks for the feedback @pacher!

There are still two .gradle cache folders though, is it normal and expected? Does not feel right.

It is expected as the other "IDEA module" imported as a "IDE only included build" is actually its own build.

@pacher pacher closed this as completed Jan 23, 2019
@jmfayard
Copy link

jmfayard commented Feb 7, 2019

@eskatos Is it the same IDE support bug that affects Android Studio 3.2?
https://github.com/jmfayard/bug-androidstudio-buildsrc
https://issuetracker.google.com/issues/123032843

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants