sts加载maven工程提示pom.xml无法解析org.apache.maven.plugins:maven-resources-plugin:2.4.3解决方案

来源:互联网 发布:淘宝香港丰胸 编辑:程序博客网 时间:2024/05/01 13:45
Multiple annotations found at this line:
- Plugin execution not covered by lifecycle 
configuration: org.apache.maven.plugins:maven-
compiler-plugin:3.1:testCompile (execution: default-
testCompile, phase: test-compile)
- Plugin execution not covered by lifecycle 
configuration: org.apache.maven.plugins:maven-
compiler-plugin:3.1:compile (execution: default-
compile, phase: compile)
- CoreException: Could not get the value for 
parameter compilerId for plugin execution default-
compile: PluginResolutionException: Plugin 
org.apache.maven.plugins:maven-compiler-plugin:3.1 
or one of its dependencies could not be resolved: 
Failed to collect dependencies for 
org.apache.maven.plugins:maven-compiler-plugin:jar:
3.1 (): ArtifactDescriptorException: Failed to read 
artifact descriptor for 
org.apache.maven.shared:maven-shared-
incremental:jar:1.1: UnresolvableModelException: 
Failure to transfer org.apache.maven.shared:maven-
shared-components:pom:19 from http://
192.168.1.17:9081/content/groups/public was cached 
in the local repository, resolution will not be 
reattempted until the update interval of sugon has 
elapsed or updates are forced. Original error: Could 
not transfer artifact org.apache.maven.shared:maven-
shared-components:pom:19 from/to sugon (http://
192.168.1.17:9081/content/groups/public): No 
response received after 60000
- CoreException: Could not get the value for 
parameter compilerId for plugin execution default-
testCompile: PluginResolutionException: Plugin 
org.apache.maven.plugins:maven-compiler-plugin:3.1 
or one of its dependencies could not be resolved: 
The following artifacts could not be resolved: 
org.codehaus.plexus:plexus-utils:jar:1.5.1, 
org.apache.maven.shared:maven-shared-utils:jar:0.1, 
com.google.code.findbugs:jsr305:jar:2.0.1: Failure to 
transfer org.codehaus.plexus:plexus-utils:jar:1.5.1 
from http://192.168.1.17:9081/content/groups/public 
was cached in the local repository, resolution will not 
be reattempted until the update interval of sugon has 
elapsed or updates are forced. Original error: Could 
not transfer artifact org.codehaus.plexus:plexus-
utils:jar:1.5.1 from/to sugon (http://192.168.1.17:9081/
content/groups/public): connection timed out to 
http://192.168.1.17:9081/content/groups/public/org/
codehaus/plexus/plexus-utils/1.5.1/plexus-

utils-1.5.1.jar


原因

这是由于缺少maven-resources-plugin-2.4.3.jar文件。这个文件是在{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\下。{user.home}是maven的配置路径,一般是我的文档,是window-preferences-MyEclipse-Maven4MyEclipse-User Setting里面的Local Repository。


解决方案

1、在pom.xml文件中加入maven-resources-plugin配置

<dependency>    <groupId>org.apache.maven.plugins</groupId>    <artifactId>maven-resources-plugin</artifactId>    <version>2.4.3</version></dependency>
2、在命令行下运行mvn install ,如果执行正确应该会在{user.home}\.m2\repository\org\apache\maven\plugins\maven-resources-plugin\下看到maven-resources-plugin-2.4.3.jar文件

3、刷新工程(右键工程选择刷新项)

4、刷新maven配置,右键工程节点,选择Maven4MyEclipse-Update Project Configuration

原创粉丝点击