问题描述
我使用Maven在Intellij Idea 2016.2上安装了春季项目.由于某些原因,我无法导入或使用ch.qos.logback.classic
包中存在的任何类.我试图使缓存无效,重新导入Maven依赖项.
I have spring project setup on Intellij Idea 2016.2 using Maven. For some reason I cannot import or use any class present in ch.qos.logback.classic
package. I tried to invalidate cache, re-import maven dependencies.
例如
import ch.qos.logback.classic.Level;
IDE提示无法解析符号级别".从命令行编译时,它说软件包ch.qos.logback.classic不存在".有什么建议可能有什么问题吗?
the IDE says 'cannot resolve symbol Level'. When compiling from command line it says 'package ch.qos.logback.classic does not exist'. Any suggestion what might be wrong?
更新-发现了问题.我已经设置了要编译的依赖范围.更新此操作解决了该问题.
Update - found the issue. I had set dependency scope to compile. Updating this fixed the issue.
推荐答案
您是否已在依赖项中添加了ch.qos.logback:logback-classic
Maven工件?
Have you added the ch.qos.logback:logback-classic
Maven artifact in your dependencies?
您的pom中应该有类似的内容:
You should have something like that in your pom :
<dependencies>
...
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.3</version>
</dependency>
...
<dependencies>
这篇关于无法使用ch.qos.logback.classic类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!