欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Maven打包生成问题解决-guava-retrying依赖guava,导致打包失败

程序员文章站 2022-03-02 19:44:31
...

Maven打包生成问题解决-guava-retrying依赖guava,导致打包失败

错误日志

[ERROR] Failed to execute goal on project dispatcher-xujian-service: Could not resolve dependencies for project com.gsafety.gemp:dispatcher-xujian-service:jar:2.0.0-SNAPSHOT: Failed to collect dependencies at com.github.rholder:guava-retrying:jar:2.0.0 -> com.google.guava:guava:jar:22.0-SNAPSHOT: Failed to read artifact descriptor for com.google.guava:guava:jar:22.0-SNAPSHOT: Could not transfer artifact com.google.guava:guava:pom:22.0-SNAPSHOT from/to ali (http://xxx/nexus/repository/maven-ali/): Transfer failed for http://xxx/nexus/repository/maven-ali/com/google/guava/guava/22.0-SNAPSHOT/guava-22.0-SNAPSHOT.pom 400 Repository version policy: RELEASE does not allow version: 22.0-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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :dispatcher-xujian-service

导致错误原因

打包服务引用了guava-retrying:jar:2.0.0,这个jar包又依赖于com.google.guava:guava:jar:22.0-SNAPSHOT,私服库找不到这个依赖,所以导致错误。但是错误不是在私服库中,而是在pom.xml配置文件中。

错误配置

	<dependency>
			<groupId>com.github.rholder</groupId>
			<artifactId>guava-retrying</artifactId>
			<version>2.0.0</version>
		</dependency>

修改为正确配置

<dependency>
			<groupId>com.github.rholder</groupId>
			<artifactId>guava-retrying</artifactId>
			<exclusions>
				<exclusion>
					<groupId>com.google.guava</groupId>
					<artifactId>guava</artifactId>
				</exclusion>
			</exclusions>
			<version>2.0.0</version>
		</dependency>

最后测试,打包成功。

相关标签: java基础知识