问题原因是,找不到相对应的jar包。这与Maven父子工程目录有关,比如一子工程(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>
主要是项目配置需要找到pom.xml,因为pom.xml是maven工程的核心配置文件,项目工程必须找得到这个pom.xml文件,如果是路径上的问题,可以对相对路径进行调整,比如增加../这样来控制找到pom.xml就好了。
附录,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
作者: Zealon
崇尚简单,一切简单自然的事物都是美好的。