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

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

 

最近在学习使用 Maven,用 IDEA 开发,准备以 ssm 做一个项目。

下载了 Maven,环境变量也配置了,默认的仓库也改了。

然后新建Maven项目,填写一些项目信息,选择 setting.xml 和本地仓库位置。

在 pom.xml 里添加一些需要的 依赖 jar,如

  1.     <dependency>
  2.       <groupId>javax.servletgroupId>
  3.       <artifactId>javax.servlet-apiartifactId>
  4.       <version>3.1.0version>
  5.     dependency>
  6.     
  7.     <dependency>
  8.       <groupId>javax.servlet.jspgroupId>
  9.       <artifactId>javax.servlet.jsp-apiartifactId>
  10.       <version>2.3.1version>
  11.     dependency>
  12.     
  13.     <dependency>
  14.       <groupId>javax.servletgroupId>
  15.       <artifactId>jstlartifactId>
  16.       <version>1.1.2version>
  17.     dependency>
  18.     <dependency>
  19.       <groupId>taglibsgroupId>
  20.       <artifactId>standardartifactId>
  21.       <version>1.1.2version>
  22.     dependency>
  23.     
  24.     <dependency>
  25.       <groupId>org.springframeworkgroupId>
  26.       <artifactId>spring-coreartifactId>
  27.       <version>4.3.0.RELEASEversion>
  28.     dependency>
  29.     <dependency>
  30.       <groupId>org.springframeworkgroupId>
  31.       <artifactId>spring-beansartifactId>
  32.       <version>4.3.0.RELEASEversion>
  33.     dependency>
  34.     <dependency>
  35.       <groupId>org.springframeworkgroupId>
  36.       <artifactId>spring-contextartifactId>
  37.       <version>4.3.0.RELEASEversion>
  38.     dependency>
  39.     <dependency>
  40.       <groupId>org.springframeworkgroupId>
  41.       <artifactId>spring-context-supportartifactId>
  42.       <version>4.3.0.RELEASEversion>
  43.     dependency>
  44.     <dependency>
  45.       <groupId>org.springframeworkgroupId>
  46.       <artifactId>spring-webartifactId>
  47.       <version>4.3.0.RELEASEversion>
  48.     dependency>
  49.     
  50.     <dependency>
  51.       <groupId>org.springframeworkgroupId>
  52.       <artifactId>spring-testartifactId>
  53.       <version>4.3.0.RELEASEversion>
  54.     dependency>
  55.     
  56.     <dependency>
  57.       <groupId>org.springframeworkgroupId>
  58.       <artifactId>spring-webmvcartifactId>
  59.       <version>4.3.0.RELEASEversion>
  60.     dependency>
  61.     
  62.     <dependency>
  63.       <groupId>org.springframeworkgroupId>
  64.       <artifactId>spring-txartifactId>
  65.       <version>4.3.0.RELEASEversion>
  66.     dependency>
  67.     
  68.     <dependency>
  69.       <groupId>org.springframeworkgroupId>
  70.       <artifactId>spring-jdbcartifactId>
  71.       <version>4.3.0.RELEASEversion>
  72.     dependency>
  73.     
  74.     <dependency>
  75.       <groupId>org.springframeworkgroupId>
  76.       <artifactId>spring-aopartifactId>
  77.       <version>4.3.0.RELEASEversion>
  78.     dependency>
  79.     <dependency>
  80.       <groupId>org.springframeworkgroupId>
  81.       <artifactId>spring-aspectsartifactId>
  82.       <version>4.3.0.RELEASEversion>
  83.     dependency>
  84.     
  85.     <dependency>
  86.       <groupId>org.mybatisgroupId>
  87.       <artifactId>mybatisartifactId>
  88.       <version>3.4.0version>
  89.     dependency>
  90.     <dependency>
  91.       <groupId>org.mybatisgroupId>
  92.       <artifactId>mybatis-springartifactId>
  93.       <version>1.3.0version>
  94.     dependency>
  95.     
  96.     <dependency>
  97.       <groupId>mysqlgroupId>
  98.       <artifactId>mysql-connector-javaartifactId>
  99.       <version>5.1.30version>
  100.     dependency>
  101.     
  102.     <dependency>
  103.       <groupId>com.alibabagroupId>
  104.       <artifactId>druidartifactId>
  105.       <version>1.0.16version>
  106.     dependency>
  107.     
  108.     <dependency>
  109.       <groupId>log4jgroupId>
  110.       <artifactId>log4jartifactId>
  111.       <version>1.2.17version>
  112.     dependency>
  113.     <dependency>
  114.       <groupId>org.slf4jgroupId>
  115.       <artifactId>slf4j-apiartifactId>
  116.       <version>1.7.21version>
  117.     dependency>
  118.     
  119.     <dependency>
  120.       <groupId>commons-logginggroupId>
  121.       <artifactId>commons-loggingartifactId>
  122.       <version>1.2version>
  123.     dependency>
  124.     
  125.     <dependency>
  126.       <groupId>junitgroupId>
  127.       <artifactId>junitartifactId>
  128.       <version>4.12version>
  129.       <scope>testscope>
  130.     dependency>

 

点击 IDE 右边的 Maven Project,点击 install

 

然后,就会从阿里云下载 jar 到本地仓库,等下载完了后,怎么还是波浪线,这就是问题所在。

原因是没有更新项目

解决方法

点击项目,右键然后 Maven-->Reimport

 

然后就好了

你可能感兴趣的:(IntelliJ IDEA Maven 无法导入jar,出现红色波浪线。)