can't get intellij to recognize classes from a different gradle subproject

Answered

I have a kotlin multi-project set up the way gradle says to do it:

```
project/
├── build.gradle.kts
├── config
│   └── detekt
├── gradle
│   └── wrapper
├── gradlew
├── gradlew.bat
├── jobs
│   ├── build
│   ├── build.gradle.kts
│   └── src
├── lib
│   ├── build
│   ├── build.gradle.kts
│   └── src
```

When I'm working on something in the jobs/ subproject, intellij doesn't recognize any of my classes from lib/. However, everything compiles, tests, and runs fine, so gradle has no issues.

For instance, lib has a package monitor:
```
lib/src/main/
├── kotlin
│   └── com
│   └── company
│   └── group
│   ├── account
│   │   ├── Account.kt
│   │   └── Accounts.kt
```

I import from that account in jobs/

import com.company.group.account.AccountAccessor


but in intellij, `account` is in red and says "unresolved reference

I've tried re-importing the project several times, and it doesn't work.

What am I missing?

 

0
5 comments
Avatar
Permanently deleted user

Oh...idea community 2020.2, ubuntu 18.04, gradle, kotlin.

0

So, can you build project from Build | Rebuild Project action successfully? but editor shows "red" unresolved imports?

How do you configure dependency on modules in Gradle? Is there a project available to check? For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service. Please also include all IDE logs (Help | Collect Logs and Diagnostic Data action).

0
Avatar
Permanently deleted user

Yes, the project builds and rebuilds just fine, with the jobs/ subproject using a class from the lib subproject. But intellij shows red unresolved imports.

I have an attempt at a minimal example here. I intentionally left most of the cruft in the dependencies and cruft in build.gradle.kts in case that has something to do with it.

https://github.com/sean-abbott/minimal_kotlin_intellij_example

0
Avatar
Permanently deleted user

And here's the logs and whatnot: Upload id: 2020_09_30_7Hj3YVydzstqo2ha (file: idea-logs-20200930-151250.zip)  (that's to your upload service)

0

Thank you for the sample project! Looks like a bug. I have reported in to our issue tracker. Please follow it here for further progress: https://youtrack.jetbrains.com/issue/KT-42378

0

Please sign in to leave a comment.