关于将项目打包成jar的问题
来源:7-1 项目重难点总结
慕仔5998689
2021-07-25 09:02:23
老师您好!我想将项目打包成jar包,是将course-list、course-price、course-zuul、eureka-service这几个子模块分别打包是吗?
我在将course-list、course-zuul、eureka-service这三个子模块按照clean、package、inatall的顺序可以进行成功的打包,但是由于course-price子模块依赖course-list子模块,在打包过程一直报以下错误:
[ERROR] Failed to execute goal on project course-price: Could not resolve dependencies for project com.imooc:course-price:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.imooc:course-list:jar:0.0.1-SNAPSHOT: Failed to read artifact descriptor for com.imooc:course-list:jar:0.0.1-SNAPSHOT: Could not find artifact com.imooc:course-service: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
Process finished with exit code 1
在打包course-price模块之前,course-list子模块已经成功打包且install,在本地仓库.m2/repository是可以找到course-list对应的jar包的。想请问为什么这里course-price模块打包还是会出现找不到course-list依赖的错误呢? 谢谢老师!
1回答
好帮手慕小尤
2021-07-25
同学你好,1、course-price子模块依赖course-list子模块,则建议同学先对course-list子模块进行clean和install,然后course-price子模块进行clean和install。
2、同学也可以使用下方install命令试一下,查看是否可以成功引入依赖。
mvn install:install-file -Dfile=你的本地依赖包的地址 -DgroupId=examples-jna -DartifactId=examples-jna -Dversion=1.0.0 -Dpackaging=jar -DgeneratePom=true
祝学习愉快!
相似问题