maven总结
2019-12-21 本文已影响0人
后来丶_a24d
命令总结
-
mvn强制更新 mvn claen install -U -e
-
mvn install Dmaven.test.skip=true 跳过测试
-
mvn install一下如果有依赖冲突,则解决
-
查看依赖树 mvn dependency:tree, 不过我比较喜欢用maven helper插件
排查maven依赖冲突总结
例子1
- 公共jar包引入ESClient, pom引入rest-high-level-client,在springBoot项目中,发现classnotdef的错误,观察对应tomcat下jar包发现org.elasticsearch.elasticsearch包里面的子包没被引入。使用maven helper发现依赖冲突,本来是6.7.2版本的org.elasticsearch.elasticsearch确是5.6.10,查看pom文件发现parent标签引入了springboot的parnet, 这里面依赖了elasticsearch 5.6.10。
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>6.7.2</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<parent>
<groupId>org.springframework.boot
<artifactId>spring-boot-starter-parent
<version>2.0.4.RELEASE
</parent>
# 点进去看依赖
<groupId>org.springframework.boot
<artifactId>spring-boot-dependencies
<version>2.0.4.RELEASE
<relativePath>../../spring-boot-dependencies
</parent>
# 这里就有ealsticsearch的调用
<elasticsearch.version>5.6.10</elasticsearch.version>
<dependency>
<groupId>org.elasticsearch
<artifactId>elasticsearch
<version>${elasticsearch.version}
</dependency>