当在eclipse debug maven项目工程时,有时会出现 source not found情况。
有时候,可能进入源码页面,闪了一下就回到source not found 页面。
出现上述情况,请按下面步骤尝试操作:
【1】Tomcat 插件运行环境:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/</path>
<port>8080</port>
<server>tomcat7</server>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
【2】项目右键-debug as - debug configurations
【3】选中左侧运行环境–点击右侧对应source
- 此处的source即为运行环境关联的源码;
- 默认有一个default–jdk的类库与maven的插件仓库;
- default 文件夹下关联的jar
【4】根据需要,Add相应的源码
- 这里根据需要,分为项目自身源码和框架、插件源码;
① 如下,添加项目自身源码:
-
- Add - Project - 添加项目工程
即可debug当前自身项目源码!!!
② 添加框架源码
-
- Add - External Archive - 添加对应sources.jar
添加完debug,仍不能关联第三方源码,请安装插件:
安装sourcelookup 插件:
http://ifedorenko.github.io/m2e-extras/
- 1
Tips:
如果添加后不成功,请尝试移除掉 default 文件夹!!
转自:
https://blog.youkuaiyun.com/J080624/article/details/67638594