Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

some workarounds for tons of problems after importing the project #2

Open
chanjeff2 opened this issue Sep 6, 2021 · 1 comment
Open

Comments

@chanjeff2
Copy link

if there is any better solution, please let me know

1. classnotfoundexception/cannot find declaration to go to

image

mark .../src/main/java as Sources Root

2. Gradle not linked to project/cannot resolve org.jetbrains.annotations

image

click "Load Script Configuration" (or whatever there) on the blue alert message "bar".

if there are multiple "bars", just click them all.

3. output path not specified

image

goto File/Project Structure

  • make sure Java 16 is being used as Project SDK
  • make sure Project Language level is >= 15
  • set Project Compiler output to .../app/build (if it used to be empty)

Module not specified/"cross" on Main

image

open "Edit Configuration"

image

set "Use Classpath of module" to ...app.main

@Derppening
Copy link
Collaborator

Thanks for sharing your solutions. However, there are really only 2 things that you need to do:

  1. Check whether your project's Gradle is linked.

    Go to settings.gradle.kts, and there is a blue bar saying "Code insight unavailable (related Gradle project not linked)", click on "Link Gradle Project" at the other side of the bar.

image

Press "Trust Project" if it prompts whether you want to trust the Gradle project.

  1. Reload the Gradle project.

    Go to the Gradle panel (either at your right hand side, or View > Tool Windows > Gradle), and click the refresh button (top-left corner of the panel, looks like a reload button).

image

After that, your project should be successfully linked to Gradle.

You may also check whether the Gradle settings of IntelliJ is configured properly by going to File > Settings and navigating to Build, Execution, Deployment > Build Tools > Gradle and check the following items:

  • Build and run using: Gradle (Default)
  • Run tests using: Gradle (Default)
  • Gradle JVM: Project SDK (16)

image

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

2 participants