如何调试Maven软件的源代码
和调试maven插件方法一样
-
修改maven源代码
-
打包模块apache-maven,生成apache-maven-x.x.x-bin.tar.gz
-
解压上面的压缩包,生成目录apache-maven-x.x.x,在某个maven项目下执行/根路径/apache-maven-x.x.x/bin/mvnDebug clean install -DskipTests
-
在maven源码项目里设置远程调试,如下图,选择相应的模块,进行调试
-
当执行的Java虚拟机jvm里的相应字节码时,就会在相应的源码断点里停止
-
断点设置
m2.conf
mac下的路径/usr/local/Cellar/maven/3.6.0/libexec/bin/m2.conf
,根据第一行代码,找到上面的断点位置
main is org.apache.maven.cli.MavenCli from plexus.core
set maven.conf default ${maven.home}/conf
[plexus.core]
load ${maven.conf}/logging
optionally ${maven.home}/lib/ext/*.jar
load ${maven.home}/lib/*.jar
参考
https://www.jianshu.com/p/0fb5e3fb704d
https://www.jianshu.com/p/2f7080a4858c
https://www.jianshu.com/p/e28643507b16
http://yangtao309.github.io/blog/2014/11/14/mavendai-ma-yue-du-1/
http://yangtao309.github.io/blog/2014/11/14/mavenyuan-ma-fen-xi-2/
https://www.jianshu.com/p/2f74295be60a