在IDEA搭建Spring和SpringBoot源码阅读和代码调试跟踪的环境

一、Spring

搭建参考:
(1)https://blog.csdn.net/u011976388/article/details/80356808
(2)https://blog.csdn.net/u013310075/article/details/80707098
(3)https://www.cnblogs.com/fdzfd/p/9453021.html
(4)https://jingyan.baidu.com/article/e2284b2b898fd7e2e6118d1c.html
报错参考:
(1)https://blog.csdn.net/bskfnvjtlyzmv867/article/details/81171802
(2)https://blog.csdn.net/wu1226419614/article/details/77749605?locationnum=8&fps=1

这里我按照参考(1)文章的步骤操作,到了build项目这一步时报错:

Error:Kotlin: [Internal Error] java.lang.AbstractMethodError: org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingCompilerConfigurationComponentRegistrar.registerProjectComponents(Lcom/intellij/mock/MockProject;Lorg/jetbrains/kotlin/config/CompilerConfiguration;)V
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:172)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment.(KotlinCoreEnvironment.kt:114)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment C o m p a n i o n . c r e a t e F o r P r o d u c t i o n ( K o t l i n C o r e E n v i r o n m e n t . k t : 382 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e C o r e E n v i r o n m e n t ( K 2 J V M C o m p i l e r . k t : 281 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . c r e a t e E n v i r o n m e n t W i t h S c r i p t i n g S u p p o r t ( K 2 J V M C o m p i l e r . k t : 271 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 163 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . j v m . K 2 J V M C o m p i l e r . d o E x e c u t e ( K 2 J V M C o m p i l e r . k t : 58 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 93 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I C o m p i l e r . e x e c I m p l ( C L I C o m p i l e r . j a v a : 46 ) a t o r g . j e t b r a i n s . k o t l i n . c l i . c o m m o n . C L I T o o l . e x e c ( C L I T o o l . k t : 92 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l Companion.createForProduction(KotlinCoreEnvironment.kt:382) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:281) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:271) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:163) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:58) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:93) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:46) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92) at org.jetbrains.kotlin.daemon.CompileServiceImpl Companion.createForProduction(KotlinCoreEnvironment.kt:382)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createCoreEnvironment(K2JVMCompiler.kt:281)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.createEnvironmentWithScriptingSupport(K2JVMCompiler.kt:271)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:163)atorg.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:58)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:93)atorg.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:46)atorg.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)atorg.jetbrains.kotlin.daemon.CompileServiceImplcompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda 1. i n v o k e ( C o m p i l e S e r v i c e I m p l . k t : 98 ) a t o r g . j e t b r a i n s . k o t l i n . d a e m o n . C o m p i l e S e r v i c e I m p l 1.invoke(CompileServiceImpl.kt:98) at org.jetbrains.kotlin.daemon.CompileServiceImpl 1.invoke(CompileServiceImpl.kt:98)atorg.jetbrains.kotlin.daemon.CompileServiceImpldoCompileKaTeX parse error: Can't use function '$' in math mode at position 8: inlined$̲ifAlive$lambda$…inlined i f A l i v e ifAlive ifAlivelambda$2.invoke(CompileServiceImpl.kt:98)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:859)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:831)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:379)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport 1. r u n ( T r a n s p o r t . j a v a : 197 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . T r a n s p o r t . s e r v i c e C a l l ( T r a n s p o r t . j a v a : 196 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t . h a n d l e M e s s a g e s ( T C P T r a n s p o r t . j a v a : 568 ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 1.run(Transport.java:197) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java:196) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568) at sun.rmi.transport.tcp.TCPTransport 1.run(Transport.java:197)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.Transport.serviceCall(Transport.java:196)atsun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport C o n n e c t i o n H a n d l e r . l a m b d a ConnectionHandler.lambda ConnectionHandler.lambdarun 0 ( T C P T r a n s p o r t . j a v a : 683 ) a t j a v a . s e c u r i t y . A c c e s s C o n t r o l l e r . d o P r i v i l e g e d ( N a t i v e M e t h o d ) a t s u n . r m i . t r a n s p o r t . t c p . T C P T r a n s p o r t 0(TCPTransport.java:683) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport 0(TCPTransport.java:683)atjava.security.AccessController.doPrivileged(NativeMethod)atsun.rmi.transport.tcp.TCPTransportConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

解决方法参考:
https://blog.csdn.net/bskfnvjtlyzmv867/article/details/81171802
即这个主要是Kotlin插件的版本问题,解决方案是更新新版本的Kotlin插件:
https://www.jianshu.com/p/7c625599c1c9

然后重新引入的spring-cglib-repack和spring-objenesis-repack的jar包需要先自行下载,然而有更好的办法:
https://blog.csdn.net/yjteilz/article/details/53906368
解决这两个包的缺失问题后reimport一下,然后build。
这次又有新的错误:

Error:(19, 49) java: 找不到符号
符号: 类 AnnotationBeanConfigurerAspect
位置: 程序包 org.springframework.beans.factory.aspectj
。。。

解决方法参考:https://jira.spring.io/browse/SPR-12103
然而上面的链接中没有明确的解决方法,参考下面这个:
https://blog.csdn.net/qq_33240946/article/details/80433192
即unload aspects包,然后如果自己的demo用到这个包就在pom文件引入aspects和aop。
unload步骤参考:http://wiki.jikexueyuan.com/project/intellij-idea-tutorial/settings-introduce-4.html
再build,这次又轮到oxm模块报错,需要参考链接(2)的文章。

二、SpringBoot

解压SpringBoot源码压缩包的过程中会报错:文件夹路径过长
别用WinRAR,换一个解压软件(例如7-zip),但也不行,所以只能采用git clone的方式把源码下载下来。

你可能感兴趣的:(Spring)