Git
git初始化:git pull origin master --allow-unrelated-histories
忽略被add的文件:git rm --cached -r /tmp
Arthas
arthas执行Spring Bean方法
1、有static method可以获取到bean
sc -d com.test.utils.SpringContextUtil //获取classLoaderHash
ognl -x 1 '#rt=@com.test.utils.SpringContextUtil@getBean("redisTemplate"),#rt.boundSetOps("test").remove("hello")' -c {scHash}
2、无static method可以获取到bean
sc -d org.springframework.context.ApplicationContext //获取classLoaderHash
vmtool --action getInstances -c {scHash} --className org.springframework.context.ApplicationContext --express '#ctx=instances[0],#rt=#ctx.getBean("redisTemplate"),#rt.boundValueOps("test").get()'
执行结果存日志
arthas.aliyun.com/doc/save-lo…
Maven
依赖冲突排查
查看依赖树:mvn dependency:tree -Dverbose
如果显示version managed from x.x.x,说明默认依赖的版本x.x.x被maven强制更改了,有以下3种原因导致:
1、该项目的dependencyManagement部分明确指定了依赖版本
2、父pom中定义了指定的版本管理
3、使用了BOM(Bill of Materials)来管理版本
上述第1点可自行查看,第2点可通过下述命令,查找对应的x.x.x定义位置
mvn help:effective-pom -Dverbose
如果是继承自父pom,可在本项目中,重新定义dependencyManagement,进行版本覆盖