IntelliJ IDEA Maven 无法导入jar,出现红色波浪线

问题 IntelliJ IDEA Maven 无法导入jar,出现红色波浪线。像这样   最近在学习使用 Maven,用 IDEA 开发,准备以 ssm 做一个项目。 下载了 Maven,环境变量也配置了,默认的仓库也改了。 然后新建Maven项目,填写一些项目信息,选择 setting.xml 和本地仓库位置。 在 pom.xml 里添加一些需要的 依赖 jar,如
  1. <!-- 添加sevlet支持 -->
  2.     <dependency>
  3.       <groupId>javax.servlet</groupId>
  4.       <artifactId>javax.servlet-api</artifactId>
  5.       <version>3.1.0</version>
  6.     </dependency>
  7.     <!-- 添加jsp支持 -->
  8.     <dependency>
  9.       <groupId>javax.servlet.jsp</groupId>
  10.       <artifactId>javax.servlet.jsp-api</artifactId>
  11.       <version>2.3.1</version>
  12.     </dependency>
  13.     <!-- 添加jstl支持 -->
  14.     <dependency>
  15.       <groupId>javax.servlet</groupId>
  16.       <artifactId>jstl</artifactId>
  17.       <version>1.1.2</version>
  18.     </dependency>
  19.     <dependency>
  20.       <groupId>taglibs</groupId>
  21.       <artifactId>standard</artifactId>
  22.       <version>1.1.2</version>
  23.     </dependency>
  24.     <!-- 添加spring支持 -->
  25.     <dependency>
  26.       <groupId>org.springframework</groupId>
  27.       <artifactId>spring-core</artifactId>
  28.       <version>4.3.0.RELEASE</version>
  29.     </dependency>
  30.     <dependency>
  31.       <groupId>org.springframework</groupId>
  32.       <artifactId>spring-beans</artifactId>
  33.       <version>4.3.0.RELEASE</version>
  34.     </dependency>
  35.     <dependency>
  36.       <groupId>org.springframework</groupId>
  37.       <artifactId>spring-context</artifactId>
  38.       <version>4.3.0.RELEASE</version>
  39.     </dependency>
  40.     <dependency>
  41.       <groupId>org.springframework</groupId>
  42.       <artifactId>spring-context-support</artifactId>
  43.       <version>4.3.0.RELEASE</version>
  44.     </dependency>
  45.     <dependency>
  46.       <groupId>org.springframework</groupId>
  47.       <artifactId>spring-web</artifactId>
  48.       <version>4.3.0.RELEASE</version>
  49.     </dependency>
  50.     <!--spring test支持-->
  51.     <dependency>
  52.       <groupId>org.springframework</groupId>
  53.       <artifactId>spring-test</artifactId>
  54.       <version>4.3.0.RELEASE</version>
  55.     </dependency>
  56.     <!--spring mvc支持-->
  57.     <dependency>
  58.       <groupId>org.springframework</groupId>
  59.       <artifactId>spring-webmvc</artifactId>
  60.       <version>4.3.0.RELEASE</version>
  61.     </dependency>
  62.     <!--spring 事务管理支持-->
  63.     <dependency>
  64.       <groupId>org.springframework</groupId>
  65.       <artifactId>spring-tx</artifactId>
  66.       <version>4.3.0.RELEASE</version>
  67.     </dependency>
  68.     <!--spring jdbc操作支持-->
  69.     <dependency>
  70.       <groupId>org.springframework</groupId>
  71.       <artifactId>spring-jdbc</artifactId>
  72.       <version>4.3.0.RELEASE</version>
  73.     </dependency>
  74.     <!--spring aop编程支持-->
  75.     <dependency>
  76.       <groupId>org.springframework</groupId>
  77.       <artifactId>spring-aop</artifactId>
  78.       <version>4.3.0.RELEASE</version>
  79.     </dependency>
  80.     <dependency>
  81.       <groupId>org.springframework</groupId>
  82.       <artifactId>spring-aspects</artifactId>
  83.       <version>4.3.0.RELEASE</version>
  84.     </dependency>
  85.     <!-- 添加mybatis支持 -->
  86.     <dependency>
  87.       <groupId>org.mybatis</groupId>
  88.       <artifactId>mybatis</artifactId>
  89.       <version>3.4.0</version>
  90.     </dependency>
  91.     <dependency>
  92.       <groupId>org.mybatis</groupId>
  93.       <artifactId>mybatis-spring</artifactId>
  94.       <version>1.3.0</version>
  95.     </dependency>
  96.     <!--  jdbc驱动包 -->
  97.     <dependency>
  98.       <groupId>mysql</groupId>
  99.       <artifactId>mysql-connector-java</artifactId>
  100.       <version>5.1.30</version>
  101.     </dependency>
  102.     <!-- 添加阿里巴巴连接池Druid支持 -->
  103.     <dependency>
  104.       <groupId>com.alibaba</groupId>
  105.       <artifactId>druid</artifactId>
  106.       <version>1.0.16</version>
  107.     </dependency>
  108.     <!-- 添加log4j日志 -->
  109.     <dependency>
  110.       <groupId>log4j</groupId>
  111.       <artifactId>log4j</artifactId>
  112.       <version>1.2.17</version>
  113.     </dependency>
  114.     <dependency>
  115.       <groupId>org.slf4j</groupId>
  116.       <artifactId>slf4j-api</artifactId>
  117.       <version>1.7.21</version>
  118.     </dependency>
  119.     <!-- apache共公包 -->
  120.     <dependency>
  121.       <groupId>commons-logging</groupId>
  122.       <artifactId>commons-logging</artifactId>
  123.       <version>1.2</version>
  124.     </dependency>
  125.     <!-- 添加junit支持 -->
  126.     <dependency>
  127.       <groupId>junit</groupId>
  128.       <artifactId>junit</artifactId>
  129.       <version>4.12</version>
  130.       <scope>test</scope>
  131.     </dependency>
  点击 IDE 右边的 Maven Project,点击 install   然后,就会从阿里云下载 jar 到本地仓库,等下载完了后,怎么还是波浪线,这就是问题所在。 原因是没有更新项目 解决方法 点击项目,右键然后 Maven-->Reimport   然后就好了   本文链接:https://liuyanzhao.com/6023.html

发表评论

目前评论:2