为什么 IntelliJ 给我“包不存在"?错误? [英] Why does IntelliJ give me "Package doesn't exist" error?
问题描述
我正在尝试使用烧烤条码打印库.我已经通过项目结构添加库成功地将库添加到 IntelliJ.然后我导入了包并编写了方法,这没有给我带来任何错误.课程中提供了这些软件包.
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 packages and wrote the methods, which gave me no error. The packages were available in the class.
但是当我编译它给了我错误:
But when I compile it gives me the error:
error: package net.sourceforge.barbecue does not exist
这怎么可能?
我正在 ubuntu 中编码,还有其他地方需要添加库吗?
I'm coding in ubuntu, is there any other place to which I have to add the library?
推荐答案
只是重新导入没有用.以下为我工作.
Just reimport didn't work. Following worked for me.
文件 ->使缓存无效/重新启动
File -> Invalidate Caches /Restart
然后
构建 ->重建项目
这将重新导入 maven 项目.
That will reimport maven project.
注意:您需要使缓存失效并重建项目.
这篇关于为什么 IntelliJ 给我“包不存在"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!