java - idea 创建了maven的项目,pom.xml中添加了mybatis依赖了,但是代码中找不都?
巴扎黑
巴扎黑 2017-04-18 10:17:16
0
6
922

pom.xml

代码中写找不到类:

为什么呢??

**

加粗文字**

巴扎黑
巴扎黑

reply all(6)
小葫芦

inTerminal中手动运行mvn clean install.
If the operation is successful, you can refresh the project.

伊谢尔伦

pom.xml has two errors

  1. The dependency of mybatis does not end with </dependency>;

  2. All children of dependency应该是<dependencies></dependencies>;

As long as there are no errors in pom.xml and the warehouse address configured in settings.xml can be connected successfully, just execute maven > reimport in the IDE and the jar package will be downloaded to the local warehouse.

But there is one situation that you should pay attention to: sometimes the download may be interrupted halfway, and then re-download will not be able to download again because of the damaged jar package downloaded before. At this time, usually go to the local warehouse path and manually download the previously downloaded Just remove the jar package.

巴扎黑

Is the package path of

ctrl+alt+shift+s, 在弹出的面板里面看选择Libraries,看一下有没有mybatis的jar包,如果没有的话就是没下好,执行一下reimport试试。
否则的话看一下你源码中有没有import,或者import right or wrong? I think this is more likely... After all, the custom classes in the code cannot be found. . .
If there is no problem with the above... Re-import this project, this is a universal solution. .

巴扎黑

刘奇

Is it possible to write a dependency and a denpendency in your pom?

Do you have import org.apache.ibatis.session.SqlSessionFactory in your java file?

Click on External Libraries and look for
Maven:org.mybatis:mybatis:version number

黄舟

Right-click on pom.xml and report again. If the speed is slow, it is recommended to directly download the jar and put it into your maven library

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template