默认的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的东西,点进来
办法如下:
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的东西,点进来