Eclipse中使用Maven我遇到过的常见报错解决整理

[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project com.MyProjectX:MyProjectX-manager-web:0.0.1-SNAPSHOT (E:\prj\Tech_accumulation\study_demo\MyProjectX-mvnProject\MyProjectX-manager\MyProjectX-manager-web\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for com.MyProjectX:MyProjectX-manager:0.0.1-SNAPSHOT: Could not find artifact com.MyProjectX:MyProjectX-parent:pom:0.0.1-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ com.MyProjectX:MyProjectX-manager:0.0.1-SNAPSHOT, E:\prj\Tech_accumulation\study_demo\MyProjectX-mvnProject\MyProjectX-manager\pom.xml, line 4, column 10 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
原因:在子模块中找不到父模块的pom.xml及相关依赖。元素的属性:: 表示父模块POM的相对路径,在构建的时候,Maven会先根据relativePath检查父POM,如果找不到,再从本地仓库查找
解决:
配置relativePath
   
        com.MyProjectX
        prj-parent
        0.0.1-SNAPSHOT
        ../prj-parent/pom.xml   //relativePath的默认值: ../pom.xml
   


资料:Maven详解之聚合与继承 http://blog.csdn.net/wanghantong/article/details/36427411


***********************************************************************************************************************
[ERROR] Failed to execute goal on project MyProjectX-manager-web: Could not resolve dependencies for project com.MyProjectX:MyProjectX-manager-web:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [com.MyProjectX:MyProjectX-common:jar:0.0.1-SNAPSHOT (compile), commons-logging:commons-logging:jar:1.2 (compile), mysql:mysql-connector-java:jar:5.1.40 (compile), org.springframework:spring-aop:jar:4.3.10.RELEASE (compile), org.springframework:spring-aspects:jar:4.3.10.RELEASE (compile), org.springframework:spring-beans:jar:4.3.10.RELEASE (compile), org.springframework:spring-context:jar:4.3.10.RELEASE (compile), org.springframework:spring-core:jar:4.3.10.RELEASE (compile), org.springframework:spring-expression:jar:4.3.10.RELEASE (compile), org.springframework:spring-instrument:jar:4.3.10.RELEASE (compile), org.springframework:spring-jdbc:jar:4.3.10.RELEASE (compile), org.springframework:spring-orm:jar:4.3.10.RELEASE (compile), org.springframework:spring-test:jar:4.3.10.RELEASE (compile), org.springframework:spring-web:jar:4.3.10.RELEASE (compile), org.springframework:spring-webmvc:jar:4.3.10.RELEASE (compile), org.mybatis:mybatis:jar:3.4.1 (compile), com.alibaba:druid:jar:1.0.29 (compile), javax.servlet:jstl:jar:1.2 (compile), taglibs:standard:jar:1.1.1 (compile), junit:junit:jar:3.8.1 (test), javax.servlet:javax.servlet-api:jar:3.1.0 (provided)]: Failed to read artifact descriptor for 
原因:依赖的jar或是工程找不到。
解决:在Maven的setting.xml中增加maven远程仓库镜像。http://www.cnblogs.com/hadoop2015/p/5717159.html    ---Failed to read artifact descriptor--maven问题总结(能力工场)


********************************************************************************************************
com.MyProjectX:MyProjectX-common:jar:0.0.1-SNAPSHOT: Could not find artifact com.MyProjectX:MyProjectX-parent:pom:0.0.1-SNAPSHOT -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
Could not find artifact com.MyProjectX:MyProjectX-parent:pom:0.0.1-SNAPSHOT -> [Help 1]
原因:依赖了MyProjectX:MyProjectX-parent工程。
解决: 将MyProjectX-parent 执行build install



********************************************************************************************************
  Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Initialization of bean failed; nested exception is java.lang.UnsupportedClassVersionError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException : Unsupported major.minor version 51.0
 (1)没有引入aspectjweaver有关的jar包  http://blog.csdn.net/you23hai45/article/details/56292396
    引入之后没有报错了。
   
   
        aspectj
        aspectjweaver
        1.5.3
   



***********************************************************************************
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project MyProjectX-manager-web: Failed to retrieve remote metadata com.MyProjectX:MyProjectX-manager-web:0.0.1-SNAPSHOT/maven-metadata.xml: 
Could not transfer metadata com.MyProjectX:MyProjectX-manager-web:0.0.1-SNAPSHOT/maven-metadata.xml from/to user-snapshot 

(http://localhost:8081/nexus/content/repositories/user-snapshot/): Connection refused: no further information to http://localhost:8081/nexus/content/repositories/user-snapshot/com/MyProjectX/MyProjectX-manager-web/0.0.1-SNAPSHOT/maven-metadata.xml -> [Help 1]
[ERROR] 
原因:maven向tomcat中deploy时,需要tomcat先运行起来。
解决:先运行tomcat,再deploy.

你可能感兴趣的:(Maven)