Package doesn't exist error in intelliJ

后端 未结 25 1176
心在旅途
心在旅途 2020-11-28 20:07

I\'m trying to use the barbecue barcode printing library. I have successfully added the library to IntelliJ through project structure add library. Then I imported the packa

相关标签:
25条回答
  • What happens here is the particular package is not available in the cache. Resetting will help solve the problem.

    1. File -> Invalidate Caches /Restart
    2. Goto terminal and build the project again

      ./gradlew build
      

    This should download all the missing packages again

    0 讨论(0)
  • 2020-11-28 20:51

    Right click your project / Maven (at bottom) / Reimport

    Edit, much later: I also saw this happen much more frequently when I had the Clover plugin installed. Drop that plugin like a bad habit!

    0 讨论(0)
  • 2020-11-28 20:52

    In case you're facing very weird "unable to resolve java, sun packages problem", try the following:

    1. Open Project Structure and change Project SDK to another version, example: java 8 -> 9; 11->13, etc, and wait until it re-index all jdk's jars. Switch between jdks with same version may not work! (Ex: jetbrains jdk11 -> openjdk 11)
    2. Open a new project (or create a empty one); pause new project's indexing; close the old one; start indexing; open the old project and pause the new project's indexing and wait.
    0 讨论(0)
  • 2020-11-28 20:52

    I tried compile a java 8 project with JDK 12 and has the same issue. None of previous answer solved my problem.

    I changed o Shortel Command Line to "JAR Manifest" and worked like a charm.

    0 讨论(0)
  • 2020-11-28 20:53

    Invalidate Caches/ Restart and then Build -> Rebuild Project helped for me

    0 讨论(0)
  • 2020-11-28 20:53

    It's a very annoying problem which happens quite often. Especially after switching to a different git branch. It wasted me way too much time to troubleshoot this kind problem. I have tried all the methods above. But I can't find a reliable way. Here I just summarize those steps which could help in my situation. Jetbrains, please fix this issue to save your customer's precious time.

    1. Make sure do a success command line build (If UT failed, please ignore UT by using -Dmaven.test.skip=true.
    2. In the "Maven Projects" view, try to use "reimport" all the maven project.
    3. In the file menu, use "Invalidate Caches"
    4. Delete .idea folder, basically create the workspace from scratch. (That's the only reliable way can solve this issue)
    0 讨论(0)
提交回复
热议问题