问题原因是,子工程(Sub1)所继承的父工程(Main)也继承了它的父工程(Parent),需要在(Main)这个父工程中pom.xml配置中,增加
relativePath:
<parent> <groupId>cn.corpdata.framework</groupId> <artifactId>framework-parent</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../framework-parent/pom.xml</relativePath> </parent>
测试Maven工程的报错如下:
[ERROR] 'dependencies.dependency.version' for mysql:mysql-connector-java:jar is missing. @ cn.corpdata.framework:framework-dao:[unknown-version], /Users/admin/Documents/workspace-sts-3.8.4.RELEASE/framework-main/framework-dao/pom.xml, line 19, column 15
[ERROR] 'dependencies.dependency.version' for commons-dbcp:commons-dbcp:jar is missing. @ cn.corpdata.framework:framework-dao:[unknown-version], /Users/admin/Documents/workspace-sts-3.8.4.RELEASE/framework-main/framework-dao/pom.xml, line 25, column 15
[ERROR] 'dependencies.dependency.version' for org.springframework:spring-context:jar is missing. @ cn.corpdata.framework:framework-dao:[unknown-version], /Users/admin/Documents/workspace-sts-3.8.4.RELEASE/framework-main/framework-dao/pom.xml, line 31, column 15
[ERROR] 'dependencies.dependency.version' for org.mybatis:mybatis:jar is missing. @ cn.corpdata.framework:framework-dao:[unknown-version], /Users/admin/Documents/workspace-sts-3.8.4.RELEASE/framework-main/framework-dao/pom.xml, line 37, column 15
[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/ProjectBuildingException
来源:https://www.cnblogs.com/zealon/p/7190868.html