在用Idea导入一个父子关系项目时,子项目无法识别父项目的依赖。原因是父项目的父项目依赖是在内网的一个maven私服上的。
<!-- <parent>-->
<!-- <groupId>com.sci99.cloud</groupId>-->
<!-- <artifactId>sci-cloud-platform</artifactId>-->
<!-- <version>1.0.0-SNAPSHOT</version>-->
<!-- <relativePath/> <!– lookup parent from repository –>-->
<!-- </parent>-->
注释掉这个依赖,改成springboot的parent依赖。
更新maven后发现还是不行,在父工程的lifecycle下执行clean,发现报错信息如下:
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] 'dependencies.dependency.version' for com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:jar is missing. @ line 159, column 21
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.sci99:accountcenter:0.0.1-SNAPSHOT (D:\内部项目\AccountCenter\accountcenter\pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for com.alibaba.cloud:spring-cloud-starter-alibaba-nacos-discovery:jar is missing. @ line 159, column 21
[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
原来是子项目的一个依赖没有指定具体版本号,导致了子项目无法识别父项目,将子项目缺少版本号的依赖注释掉或者明确指定一下版本号即可。