在的项目Pom.xml中最后加入:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
<projectnature>org.eclipse.m2e.core.maven2Nature</projectnature>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.eclipse.jdt.core.javabuilder</buildcommand>
<buildcommand>org.eclipse.m2e.core.maven2Builder</buildcommand>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
</configuration>
</plugin>
</plugins>
</build>
然后再项目目录下执行:
mvn dependency:sources
mvn eclipse:eclipse
再刷新一下eclipse的项目空间.
=================================
Source not found might be legitimate for dynamically loaded code (e.g. Maven).
There are three workarounds known to me (after months of search):
-
Connect to a running JVM with the debugger and you will see the code.
-
Use Dynamic Source Lookup plugin for Eclipse from here:
https://github.com/ifedorenko/com.ifedorenko.m2e.sourcelookup
-
Use run-jetty-run Maven plugin