idea2019.2最快捷编译spring5.0.x源码
为了编译spring5源码折腾了3天,
⽤了IDEA2019.3报错
exception during working with external system: java.lang.AssertionError
at org.adle.service.project.BaseGradleProjectResolverExtension.populateModuleContentRoots(BaseGradleProjectResolverExtension.java:2 at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.jetbrains.figuration.KotlinMPPGradleProjectResolver.populateModuleContentRoots(KotlinMPPGradleProjectResolver.kt:65)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
at org.adle.service.project.AbstractProjectResolverExtension.populateModuleContentRoots(AbstractProjectResolverExtension.java:95)
导航网站源码下载at org.adle.service.project.TracedProjectResolverExtension.populateModuleContentRoots(TracedProjectResolverExtension.java:62)
at org.adle.service.project.GradleProjectResolver.doResolveProjectInfo(GradleProjectResolver.java:382)
at org.adle.service.project.GradleProjectResolver.access$200(GradleProjectResolver.java:76)
at org.adle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:879)
at org.adle.service.project.GradleProjectResolver$ProjectConnectionDataNodeFunction.fun(GradleProjectResolver.java:862)
at org.ute(GradleExecutionHelper.java:217)
at org.adle.service.solveProjectInfo(GradleProjectResolver.java:141)
at org.adle.service.solveProjectInfo(GradleProjectResolver.java:76)
at com.RemoteExternalSystemProjectResolverImpl.a(RemoteExternalSystemProjectResolverImpl.java:37)
at com.ute(AbstractRemoteExternalSystemService.java:58)
at com.solveProjectInfo(RemoteExternalSystemProjectResolverIm at com.solveProjectInfo(ExternalSystemProjectResolverWrap at com.alSystem.service.internal.ExternalSystemResolveProjectTask.doExecute(ExternalSystemResolveProjectTask.java:100)
at com.alSystem.service.ute(AbstractExternalSystemTask.java:166)
at com.alSystem.service.ute(AbstractExternalSystemTask.java:152)
at com.alSystem.util.ute(ExternalSystemUtil.java:554)
at com.alSystem.util.ExternalSystemUtil$5.run(ExternalSystemUtil.java:659)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:727)
access统计每位职工参加项目的数量at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:164)
at com.intellij.openapi.progress.isterIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.uteProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.uteProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:151)
at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:403)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at urrent.Executors$RunnableAdapter.call(Executors.java:511)
at urrent.FutureTask.run(FutureTask.java:266)
at urrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at urrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
没有解决,懒得弄了,最后换回2019.2
idea编译经常遇到spring-beans编译不过去,报Unresolved reference: BeanFactory这个错也是没解决,其他⼩问题百度也能搜到解决
办法,先总结下最简便的⽅法
准备⼯作jdk1.8.0_211,gradle-4.9,aspectj1.9安装配置⾃⼰百度
⾸先从GitHub下载spring5.0.x源码,我下载的是zip压缩包,解压后开始正式编译
第⼀步先运⾏gradlew.bat,双击或者命令⾏都可以
第⼆步:修改adle中的注释掉以下两⾏
// compileGroovy.dependsOn = compileGroovy.taskDependencies.values - "compileJava"
// compileKotlin.dependsOn(compileGroovy)
修改adle注释下⾯两个,没有做研究,为什么要注释,有的⽹站说的是编译后有的⽬录不对
dokka {
dependsOn {
}
doFirst {
classpath = llect { project -> project.jar.Files() }.flatten()
classpath += llect { it.sourceSets.mainpileClasspath })
}
moduleName = "spring-framework"
outputFormat = "html"
outputDirectory = "$buildDir/docs/kdoc"
sourceDirs = llect { project ->
def kotlinDirs = project.sourceSets.main.llect()
kotlinDirs -= project.sourceSets.main.java.srcDirs
})
externalDocumentationLink {
url = new URL("docs.spring.io/spring-framework/docs/$version/javadoc-api/")
明解c语言中级篇pdfpackageListUrl = new File(buildDir, "api/package-list").toURI().toURL()
}
externalDocumentationLink {
url = new URL("projectreactor.io/docs/core/release/api/")
}
externalDocumentationLink {
url = new URL("/reactive-streams-1.0.1-javadoc/")
}
}
asciidoctor {
sources {
transport upinclude '*.adoc'
}
resources {
from(sourceDir) {
include 'images/*', 'stylesheets/*', 'tocbot-3.0.2/*'
}
}
logDocuments = true
backends = ["html5"]
// only ouput PDF documentation for non-SNAPSHOT builds
if(!Version().toString().contains("BUILD-SNAPSHOT")) {
backends += "pdf"
mysql选择数据库}
options doctype: 'book', eruby: 'erubis'
attributes 'icons': 'font',
'idprefix': '',
'idseparator': '-',
docinfo: '',
revnumber: project.version,
sectanchors: '',
sectnums: '',
'source-highlighter': 'coderay@', // TODO switch to 'rouge' once supported by the html5 backend
stylesdir: 'stylesheets/',
stylesheet: 'main.css',
'spring-version': project.version
}
修改adle⽂件到configurations.all添加xml-apis
configurations.all {
resolutionStrategy {
force 'xml-apis:xml-apis:1.0.b2'
}
}
修改上⾯的这个是因为有时会报错误,这个错误可以在D:\.gradle\daemon\4.4.1\daemon-XXX.out.log,.gradle⽬录是环境变量⾥⾯设置的GRADLE_USER_HOME这个参数值
POM relocation to an other version number is not fully supported in Gradle : xml-apis:xml-apis:2.0.2 relocated to xml-apis:xml-apis:1.0.b2.
Please update your dependency to directly use the correct version 'xml-apis:xml-apis:1.0.b2'.
Resolution will only pick dependencies of the relocated element. Artifacts and other metadata will be ignored.
第三步,开始编译,需要先编译spring-oxm,spring-beans两个module,为啥要编译spring-beans,在idea编译的时候经常会遇到上⾯提到的Unresolved reference: BeanFactory这个错误,
注意:我编译的是在命令⾏下,为了避免的IDEA报错,还的⽹上搜解决办法,浪费时间
在命令⾏下切换到spring-framework-5.0.x⽬录下,执⾏下⾯两个命令
idea配置artifactsgradlew :spring-oxm:compileTestJava
gradlew :spring-beans:compileTestJava
我本机测试时没有报错,IDEA不保证通过Gradle插件编译是否成功,偶尔会编译出错,⼀定要确保spring-beans编译的没有问题
第四步导⼊idea,修改IDEA配置
在导⼊的时候IDEA就会⾃动编译,如果没有编译点击下⾯按钮就会⾃动编译
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论