maven项目debug查看依赖包源代码办法

默认的maven工程,好像很难加载依赖的源代码


办法如下:
maven调试时,无法进入源码
办法一,在debug配置里面,找到source,把带source的jar包,放进去,添加的时候,选add,再选external archive。这里要注意,加了后,要重启debug要不然,还是不行
办法二,打开build path,在libraries里面,找到相关的jar,然后双击source attachment,把source关联照过来
最后一个办法,也是最有用的办法
二。安装下面的插件,然后做代码关联

m2e.sourcelookup


Eclipse Plugin that provides Maven Dependencies as Source Container in JDT Launching Configuration.
Update site (P2 Repo): https://bjmi.github.io/update-site/


Note: Ensure artifact sources are present in local maven repository or enable Window > Preferences > Maven > Download Artifact Sources in Eclipse
http://ifedorenko.github.com/m2e-extras/


不清楚的可以看下面
http://stackoverflow.com/questions/12598261/maven-build-debug-in-eclipse
https://github.com/bjmi/m2e.sourcelookup
这里直接安装https://bjmi.github.io/update-site/好像就可以了,昨天安装的


但是这个办法,不是随便能成功的。eclipse不同版本,可能会安装失败。Version: Luna Service Release 2 (4.4.2),我试过最惨的,因为安装不了 m2e.sourcelookup,报错如下:
An error occurred while collecting items to be installed
session context was:(profile=epp.package.jee, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,org.eclipse.m2e.archetype.common,1.7.0.20160603-1931
No repository found containing: osgi.bundle,org.eclipse.m2e.core,1.7.0.20160603-1933
然后,就重新安装了m2e,在线的安装,结果,居然把原来的maven菜单和配置全搞没了。后来,换了一个版本的eclipse,Version: Mars.2 Release (4.5.2)
然后再安装
m2e.sourcelookup    https://bjmi.github.io/update-site/,然后在debug配置环境中,加上maven dependencies of 'my Project',实际操作是,点add 然后看到maven的东西,点进来
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值