记录今天遇到的问题~

第一次用maven,最大的感受是,不用苦苦得找jar包了 TAT

记录今天导入maven时遇到的问题,及解决方法。

bug1:

Failure to transfer org.apache.maven.plugins:maven-resources-plugin:pom:2.6 
from https://repo.maven.apache.org/maven2 was cached in the local repository,
resolution will not be reattempted until the update interval of central has elapsed or updates are forced. 
Original error: Could not transfer artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.6 
from/to central (https://repo.maven.apache.org/maven2): connect timed out

solution:
add to pom.xml:


    org.apache.maven.plugins
    maven-resources-plugin
    2.6


bug2:

Project 'zhku.springmvc1' is missing required source folder: 'src/main/resources/templates'

cause:
开发环境中,eclipse.project文件可能存在对缺失文件夹的引用,但是project中已经没有了该文件夹,导致编译的时候找不到该文件夹。

solution:
选中project-->右键-->properties--->java build path-->Source,把缺少的文件夹remove掉,重新编译就ok了

bug3:

Failure to transfer org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 
from https://repo.maven.apache.org/maven2 was cached in the local repository, 
resolution will not be reattempted until the update interval of central has elapsed or updates are forced. 
Original error: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.12.4 
from/to central (https://repo.maven.apache.org/maven2): connect timed out

cause:
从错误提示看到,maven-compiler-plugin:pom:2.12.4 从maven网上下载失败是由于本地仓库已经有该插件的缓存了,搜索了该文件后才知道在另一个本地仓库路径下有缓存该插件。

solution:
1、首先删掉另一个本地仓库已缓存的 ~.m2\repository\org\apache\maven\plugins\maven-surefire-plugin\2.12.4目录;


2、然后通过 maven->update projects,勾上 force update of snapshots/releases ,更新工程即可。


所以本地的maven仓库最好只设置一个。(应该是之前下载过maven,在D:\collegePro)

你可能感兴趣的:(java)