最近刚学javaee,运到了很多问题.....
IDEA项目的pom.xml中标红问题
org.apache.ibatis.io.Resources无法导入
org.junit.Test无法导入
上面的种种问题,很大原因是项目中maven没能成功调用JAR包中类
那怎么办?
折腾了很久,总结了下面简单粗暴的方法
……
第一步:配置好Maven
下载好apache-maven-3.6.3.zip,解压,记住它的路径,然后在设置里面配置好
apache-maven-3.6.3.zip 提取码:w9R4
第二步:在pom.xml引入mybatis相关依赖
在pom.xml中替换上下面的内容
<!--设置module打包方式-->
<packaging>jar</packaging>
<!--引入依赖-->
<dependencies>
<!-- Mybatis核心 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.5.9</version>
</dependency>
<!-- junit测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- MySQL驱动 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.39</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
</resources>
</build>
第三步 连上网络
电脑一定要连上网络!!!
电脑一定要连上网络!!!
电脑一定要连上网络!!!
第四步 把本地存储库目录下的东西全部删除(之前下载的jar,或者插件之类的东西)
第五步 maven重新联网下载jar,插件等到本地储存库
从2开始……
下载可能要分钟8,9分钟……
最终如果出现下面第一种情况,重新第四,第五步
如果第二种,就不用管,不影响
over
小白一枚,经验仅供参考,不喜勿喷,谢谢.