我正在尝试使用烧烤条形码打印库。我通过project structure add library成功将库添加到IntelliJ。然后我导入了包并编写了方法,这没有给我任何错误。这些包在类中可用。
但是当我编译时,它会给我一个错误:
error: package net.sourceforge.barbecue does not exist
这怎么可能呢?
我在ubuntu中编码,还有其他地方需要添加库吗?
我正在尝试使用烧烤条形码打印库。我通过project structure add library成功将库添加到IntelliJ。然后我导入了包并编写了方法,这没有给我任何错误。这些包在类中可用。
但是当我编译时,它会给我一个错误:
error: package net.sourceforge.barbecue does not exist
这怎么可能呢?
我在ubuntu中编码,还有其他地方需要添加库吗?
当前回答
我试着
“Maven >重新导入” 删除.idea目录,并重新打开项目。 文件->使缓存无效/重新启动然后构建->重建项目 删除本地.m2文件夹内的内容,并重新下载依赖项。 在Maven控制台中运行mvn idea:idea(虽然这个命令已经过时了,但我不得不尝试。)
在不同的组合中。
但是从Intellij 2020版本到2019版本解决了我的问题。
其他回答
以上方法都试过了,都没用。 最后运行maven清洁安装就解决了!
对我来说奏效了:
再输入 使缓存无效/重新启动 重建项目
Maven重新导入,重新构建和无效缓存不工作。我通过打开一个终端并在根文件夹项目中执行maven clean install解决了这个问题。(IntelliJ被打开,我能够看到IDE更新和触发驯鹿,而maven正在做他的工作)
我尝试用JDK 12编译一个java 8项目,也有同样的问题。 以前的答案没有一个能解决我的问题。
我把Shortel命令行改为“JAR Manifest”,工作起来很有魅力。
I created two new classes under a new package and used it in rest of the code, Intellij was able to resolve these no red highlights were shown in the intellij editor. While building it was showing package doesn't exist error. I tried everything from gradle clean build, rebuild project, clear .idea and .gradle and reimporting the project, clearing the gradle local cache but nothing was working. Finally I refactored the name of the new package and this time intellij was able to recognize the new classes and it started working.