【maven】本地项目依赖打jar包失败 Could not resolve dependencies for project

【maven】本地项目依赖打jar包失败 Could not resolve dependencies for project

#记录一下今天遇到的一个maven的打包问题
由于使用spring cloud 的微服务架构,故而有些项目的类需要公用,便想用单独的公共项目进行引用出现如下问题
1.使用Eclipse -Run -Maven builder 进行打包出现如下错误

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< com.ysservice:eureka-server-backup >-----------------
[INFO] Building eureka-server-backup 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/cn/com/ysservice/yongsheng-common/1.0/yongsheng-common-1.0.pom
[WARNING] The POM for cn.com.ysservice:yongsheng-common:jar:1.0 is missing, no dependency information available
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/cn/com/ysservice/yongsheng-common/1.0/yongsheng-common-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.269 s
[INFO] Finished at: 2018-09-28T17:37:12+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project eureka-server-backup: Could not resolve dependencies for project com.ysservice:eureka-server-backup:jar:0.0.1-SNAPSHOT: Could not find artifact cn.com.ysservice:yongsheng-common:jar:1.0 in central (https://repo.maven.apache.org/maven2) -> [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

从报错情况来看,应该是maven下载不到依赖的包
本人依赖如下

	<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
		
		<!-- 项目依赖  这是本地项目-->
		<dependency>
		    <groupId>cn.com.ysservice</groupId>
		     <artifactId>yongsheng-common</artifactId>
		     <version>1.0</version>
        </dependency>

于是想,应该是下载不到jar包,那么解决办法如下:

  1. 先将该项目 yongsheng-common 打成jar包
  2. 然后再讲本项目进行package即可成功
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值