maven dependency的版本冲突问题

 在改造一个旧项目中,遇到各种问题。

旧项目有十多个模块,因为没有一个统一的父pom,它们对第三方的jar的版本没有统一。 虽然也存在公共的依赖模块,比如commons、util,但是,我们的模块中,有时候又会自己重复引用一些基础的、已经在公共依赖模块存在的对三方jar, 这样 就造成了很多的冲突。

当我考虑统一到一个父pom里面去的时候,发现了很多问题。

[ERROR] 

[ERROR] The project com.wisdom:mint:1.0-SNAPSHOT (F:\dev\SVN\code\mint\pom.xml) has 1 error
[ERROR] Non-resolvable import POM: Could not transfer artifact io.netty:netty-bom:pom:3.6.10.Final from/to wisdom-public (http://192.168.1.95:8081/repository/wisdom-test67/): Failed to transfer file: http://192.168.1.95:8081/repository/wisdom-test67/io/netty/netty-bom/3.6.10.Final/netty-bom-3.6.10.Final.pom. Return code is: 400 , ReasonPhrase:Repository version policy: SNAPSHOT does not allow version: 3.6.10.Final. @ org.springframework.boot:spring-boot-dependencies:2.1.0.RELEASE, C:\Users\rx63\.m2\repository\org\springframework\boot\spring-boot-dependencies\2.1.0.RELEASE\spring-boot-dependencies-2.1.0.RELEASE.pom, line 988, column 25 -> [Help 2]
[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]

3.6.10.Final.是什么东东,发现是 子模块中写死的一个 property, 虽然没有在 dependency中使用它,但是它却生效了,真是神奇了。 大概是它把 spring-boot 的同名的 property 覆盖了吧, 但是 spring-boot 的当前版本依赖的netty 并不是 3.6.10.Final., 所以就出现了这个问题。 

怎么解决: 把3.6.10.Final. 的property 删除掉就好了。不过呢,“SNAPSHOT does not allow version” 是啥?    搞不懂


[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project mint: Could not resolve dependencies for project com.wisdom:mint:jar:1.0-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-web:jar:2.1.0.RELEASE -> org.hibernate.validator:hibernate-validator:jar:5.4.1.Final: Failed to read artifact descriptor for org.hibernate.validator:hibernate-validator:jar:5.4.1.Final: Could not transfer artifact org.hibernate.validator:hibernate-validator:pom:5.4.1.Final from/to wisdom-public (http://192.168.1.95:8081/repository/wisdom-test67/): Failed to transfer file: http://192.168.1.95:8081/repository/wisdom-test67/org/hibernate/validator/hibernate-validator/5.4.1.Final/hibernate-validator-5.4.1.Final.pom. Return code is: 400 , ReasonPhrase:Repository version policy: SNAPSHOT does not allow version: 5.4.1.Final. -> [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

同上的原因。

还遇到各种神奇问题,format 也有问题。

按照提示,执行下面的 命令 就好了:

mvn spring-javaformat:apply


[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-rules) @ cactus-provider ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.BannedDependencies failed with message:
Found Banned Dependency: commons-logging:commons-logging:jar:1.1.1
Use 'mvn dependency:tree' to locate the source of the banned dependencies.

[WARNING] Found duplicate (but equal) classes in [org.apache.tomcat.embed:tomcat-embed-core:8.5.35, org.apache.tomcat:tomcat-juli:8.5.35]:

commons-logging:commons-logging:jar:1.1.1  被Banned 了, 不是很好理解,把commons-logging 依赖去掉就好了。

猜你喜欢

转载自www.cnblogs.com/FlyAway2013/p/10420089.html