在eclipse下用maven新建web项目,新建过程中,报异常如下:
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
Plugin org.apache.maven.plugins:maven-war-plugin:2.2 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-war-plugin:jar:2.2
这一问题出现的原因自己的maven本地仓库中该文件夹:org/apache/maven/plugins/maven-war-plugin/2.2下,maven-war-plugin-2.2.jar缺失,或缺少maven-war-plugin-2.2.pom,形成这个的原因多半是网速等原因导致的jar包未成功下载和.pom文件内容不是xml格式的,这时要删除该文件夹下的未成功下载的后缀为.lastUpdated的文件和不合规范的.pom文件,若重来仍然出现这个问题,那么就自己手动下载maven-war-plugin-2.2.jar放至该文件夹,同时下载maven-war-plugin-2.2.pom,这时要注意该文件的后缀是.pom,网页查找maven-war-plugin-2.2.pom,打开是xml文件,另存为也会默认.xml格式,这时要将后缀改为.pom,然后也一并放在该文件夹下。
最后重新新建即可。
同时要注意:类似的Could not calculate build plan 都是因为jar包和相关的pom文件未成功下载导致的。
我在重新新建后陆续又碰到了如下异常:
1.
Failure to transfer com.thoughtworks.xstream:xstream:pom:1.3.1 from http://mirrors.ibiblio.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of ibiblio has elapsed or updates are forced. Original error: Could not transfer artifact com.thoughtworks.xstream:xstream:pom:1.3.1 from/to ibiblio (http://mirrors.ibiblio.org/maven2/): unexpected end of stream on Connection{maven.ibiblio.org:80, proxy=DIRECT hostAddress=169.55.155.238 cipherSuite=none protocol=http/1.1} (recycle count=0)
2.
Failure to transfer com.thoughtworks.xstream:xstream-parent:pom:1.3.1 from http://mirrors.ibiblio.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of ibiblio has elapsed or updates are forced. Original error: Could not transfer artifact com.thoughtworks.xstream:xstream-parent:pom:1.3.1 from/to ibiblio (http://mirrors.ibiblio.org/maven2/): connect timed out
3.
Failure to transfer org.apache.maven.shared:maven-filtering:pom:1.0-beta-2 from http://mirrors.ibiblio.org/maven2/ was cached in the local repository, resolution will not be reattempted until the update interval of ibiblio has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.shared:maven-filtering:pom:1.0-beta-2 from/to ibiblio (http://mirrors.ibiblio.org/maven2/): Software caused connection abort: recv failed
这些也是因为相关的jar包和pom文件未成功下载导致的,一一解决即可。